Make life a little easier for designers [WPF Triggers with a little less XAML and a little less code]


This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of dlaa.me.

See you there!

Comments (9)
  1. AtulGupta says:

    I will prefer the way shown by Beatriz, since that is functionality already in-built into WPF, so why write my own attached property for it

  2. Kieren5 says:

    I want to see Silverlight provide support for binding controls to each other. Not everything that happens in the view has a representation in the model (I think that’s a fair statement).

    Posted more on Nikhil’s blog:

    KierenH

    Posted on 9/13/2008 @ 6:55 AM

    http://www.nikhilk.net/ViewModel-Pattern-DLR.aspx

    In Wpf, controls can be bound to each other, how could we do this declaratively in Silverlight.

  3. tilovell says:

    Thanks, I found this very helpful for thinking about how to split my code between the WPF Xaml and C# code behind, and what would be the best way to trigger different show/hide states in my UI.

  4. Thankful CluelessNewbie says:

    Sifting through 5 years of posts strewn across vast seas of geek broken english, 2 days lost in space, stranded on giligans island, before I got to this gem. Is it me or is it xaml? Best damn trigger explanation ever!

  5. Thankful CluelessNewbie says:

    David, I don't know if you'll see this but… Now I want to change the Beatriz type solution into this:

    <Button>

    <QuickTrigger Target='Window.Processing=True' Property='IsEnabled' Default='True' Value='False'/>

    Any thoughts about how to implement this concise (although admittedly more restrictive syntax) so that it "expands" into the code above (along with the <Button.Style> element etc)?

  6. Delay says:

    Thankful CluelessNewbie,

    Thanks for the kind words! 🙂

    If you're looking for something like a pre-processor, XAML doesn't have that. Some folks run the C pre-processor on their XAML files, but that's pretty custom and I've never gone there myself. But if you're looking to implement that functionality in a more natural manner, you might look at creating a custom markup extension or maybe an attached behavior (via an attached DependencyProperty). A web search of either phrase should turn up some good examples and help you decide which is more like what you have in mind.

    Hope this helps!

  7. Furkan Gozukara says:

    Hello. I can not make ajax toolkit combine script work. I really need help. This is the topic i made at official forums : forums.asp.net/…/1

  8. Delay says:

    Furkan Gozukara,

    Everything I know about using the AJAX Control Toolkit for script combining can be found here:

    blogs.msdn.com/…/script-combining-made-easy-overview-of-the-ajax-control-toolkit-s-toolkitscriptmanager.aspx

    blogs.msdn.com/…/script-combining-made-better-overview-of-improvements-to-the-ajax-control-toolkit-s-toolkitscriptmanager.aspx

    As the note at the top of the original post says, this functionality is now available from ASP.NET itself – that's documented here:

    http://www.asp.net/…/Combining%20Client%20Scripts%20into%20a%20Composite%20Script.ashx

    You'll probably want to use the built-in support if possible because it's likely to be easier and more supported. 🙂

    Hope this helps!

Comments are closed.