Has anyone ever created a custom markup extension in WPF or Silverlight? When would you ever want or need to do this? Any tips or sources on how to do it?
From stackoverflow
-
Yes it is handy and I have created one myself. I created a markup extension called EvalBinding that takes a set of bindings as children and a C# evaluation string. It evaluates the C# to process the values from the child bindings so that I do not need to create many simple TypeConverter classes.
For example I can do this...
<EvalBinding Eval="(this[0] > this[1] ? 'GT' : 'LTE')"> <Binding ElementName="element1" Path="Size"/> <Binding ElementName="element2" Path="Size"/> <EvalBinding>
Where this is a reference to the array of child binding results.
For resources on implementing a MarkupExtension...
-
Another example would be for Localization
Note: You can not write custom markup extensions in silverlight.
Charles Graham : Ah, another in it's many limitations. I can't wait for Mix so I can figure out if they fixed this shit.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.