|
logan1337 wrote: Suppose I want to make my interface modular and abstract, so that I don't need to group everything into a single xaml file. What is the simplest and most efficient way to dynamically swap out pieces of a xaml interface?
The architecture you want to consider is the Composite Application Guidance[^]. This architecture is designed to apply the "hot swapping" because it uses IoC. Please have a look at this[^] link for more details.
logan1337 wrote: And relatedly, what's the best way to define xaml fragments that aren't entire windows themselves. User controls? Pages?
Well - I'm partial to User controls myself.
logan1337 wrote: If I want a fragment such as the above to appear floating over the other elements in a window/grid, can i do that without creating a new window?
Oh yes - WPF is full of funky 3D goodness that allows you to move elements through 3D space.
|
|
|
|
|
Thanks I will take a(nother) look at that. I had skimmed it earlier, but I thought that since it required an actual DLL that it was something way more than what I was looking for.
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
logan1337 wrote: but I thought that since it required an actual DLL that it was something way more than what I was looking for.
I hate to say this, but it drops in quite a few. You get the Unity Dll as well.
|
|
|
|
|
:P
I'm just surprised that WPF wasn't designed to be modular from the start. It seems too web-page-like, when even web pages are now becoming dynamic and modular.
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
logan1337 wrote: I'm just surprised that WPF wasn't designed to be modular from the start. It seems too web-page-like, when even web pages are now becoming dynamic and modular
Well, the big issue with WPF is that it's totally different to Win Forms programming, so the standards and techniques are being defined by the gods of WPF (like the Rockstar, Dr WPF, Sacha and the Molenator).
|
|
|
|
|
Different is fine if it's an improvement, but I am really feeling lost that what I want to do is not immediately doable. I can understand when the designers (or "gods") tell you you can't do something the old way because the new way is clearly better (like, say, MVC) but I don't see that as being the case here, at least at my current level of understanding.
I mentioned in my rant in the lounge how un-obvious it is to build and share contextual menus between multiple sources, or really to handle any kind of dynamic generation--allow me to ask you this:
Suppose I have an objective encapsulation of a "command" that can be applied to an object, and I want those commands to appear in a contextual menu when the target object is right-clicked. The name, icon, tool tip, etc. should all be figured-out from the command itself, and not statically "baked into" the interface. Furthermore, the actual selection of commands should be dynamic, based on some method that runs.
I want each MenuItem to be dynamically generated based on these "rules", and constructed based on properties of the command (i.e. the name, icon, etc.), and then to populate that context menu with the generated items... but more complicated things I would like to use (as I mentioned in the original question) an abstract modular approach, where I can define the rendering of a particular object dynamically based on an abstract XAML object, such as a user control.
Is this still possible in WPF? Obviously it isn't in XAML, but tell me I can still perform this kind of dynamic generation in code. Maybe I have the wrong impression of WPF because I'm trying to do everything in XAML when I should be looking at the programmatic methods.
Your thoughts?
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
You can reuse items just by giving them a key. A really fun thing to do is to define your item in a different assembly which can be loaded at runtime, just by using ContextMenu={DynamicResource MyMenu} in your item.
|
|
|
|
|
That's good to know. Guess I was just looking in the wrong places.
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
i need a basics of silverlight 1.0&^1.1&2
|
|
|
|
|
|
Hi all,
Please help with code and description that is there any way to call old style class library in Silverlight application?
I know that there is "Silverlight Class Library" available in dot net 3.5 but in my situation I need to call Old Class library.
Thanks in advance.
M.Fasih Akbar(SE)
fasih_is_my_signature
|
|
|
|
|
Yes, just create silverlight class library. Put your class(es) in there and compile. Then you can reference that dll from any silverlight project. Note, silverlight contains a subset of .net.
|
|
|
|
|
Hey can anybody tell me how can I validate userinputs.For example if user enters some text in textbox I want to check it and return errormessage if not a proper input.I think You undersstood what I mean to say.
|
|
|
|
|
Did you look at Textbox events here[^]. If you just want to validate then perhaps LostFocus would be fine, or if you want to want to prevent the user from entering invalid input then you may use the KeyDown event. Hope that helps.
Regards,
Syed Mehroz Alam
|
|
|
|
|
To all lovers of XAML and WPF, go and check out XAML Power Toys
http://karlshifflett.wordpress.com/2008/08/31/xaml-power-toys/[^]
I included three movies to get anyone up and running fast. Has binary install and source downloads.
This is a Visual Studio Add-In that will help you with everyday tasks like creating forms for classes in very short order.
Feature Set
• Group Into - allows developer to select one or more controls and group them inside a new parent.
• Remove Margins - allows a developer to select one or more controls and remove all margins from them.
• Create Business Form - allows a developer to quickly create a form complete with bindings if desired.
• Edit Grid & Column Rows - allows a developer to select a grid and then add or remove rows and columns.
• Create Business Form For Class - allows a developer to quickly create a form complete with bindings that are easily associated with properties on the source class.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Tres cool Mr Shiflett, tres cool (especially the Remove Margins - this has been a real bugbear for me).
|
|
|
|
|
Any time Pete.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
|
This is excellent! Thanks Karl!
|
|
|
|
|
|
Nice! I'll blog it up when I get home ...
|
|
|
|
|
Karl - if we have an add in to add to this, could we send it to you for inclusion (assuming the code meets your standards)?
|
|
|
|
|
Pete,
If it's VB.NET no problem.
If it's C# and not a huge amount of code, OK, I'll translate.
I'm working though an issue right now, should have it resolved soon.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Thanks mate. Tell you what, I'm putting together a C# addin which I'll let you have a look at - any bits that you like, I'll convert over to VB.NET, it'll be good practice for me. The first toy takes a property and converts it into a notifiable property, so it converts:
public string MyProperty { get; set; } into
private string _myProperty;
public string MyProperty
{
get
{
return _myProperty;
}
set
{
if (_myProperty != value)
{
PropertyChanged("MyProperty");
_myProperty = value;
}
}
}
|
|
|
|
|
Pete,
I already have writen a very comprehensive add-in that does all this and much more.
After Ocean, I'll write up an article on it.
XAML Power Toys will be released again tonight. I corrected all the file locking issues and wrote a way out there designer and added some very cool stuff.
I've been off-line and will be the rest of the day.
Cheers,
Karl
modified 27-Feb-21 21:01pm.
|
|
|
|