More on dependency properties
David asked why dependency properties don't use generics. Honestly, once we looked hard at it, we didn't see a great deal of gain, certainly not enough to justify the cost of making the change to all the people using DP's. If you're calling through the CLR wrappers (and we strongly encourage the use of CLR wrappers), there's not that much programming model benefit to generics. "checkbox.Checked = true" looks the same with or without DP<T>, and it still beats checkbox.SetValue(CheckBox.CheckedProperty, true).
There wasn't really a performance win, either, because the property engine has to box all these values anyway to provide storage for all the properties. And there was even the possibility of a performance regression because of extra codegen that sometimes happens with generics. Probably overcomable, but at the end of the day, seemed a lot less important than other things we could improve on.
We're always on the lookout for ways to improve the declaration of dependency properties. One thing that helps is a Visual Studio 2005 feature called "snippets", which is great for writing boilerplate code. The "propdp" snippet is part of the May CTP of "Fidalgo" (I can't even begin to keep track of the public name for that one -- Visual Studio Extensions for WPF? Something like that, it's the same package that provides the schema for xaml)
Comments
- Anonymous
August 30, 2005
I'm trying to rebind templated TableBody to other XmlDocument,it looks something like:
XmlDocument doc=xs.Document??new XmlDocument();
System.Windows.Data.Binding bx=BindingOperations.GetBinding(test1,TableBody.ItemsSourceProperty);
BindingOperations.ClearBinding(test1,TableBody.ItemsSourceProperty);
test1.Items.Clear();
using(xs.DeferRefresh()) {
doc.Load(m.GetBodyReader());
xs.Document=doc;
}
BindingOperations.SetBinding(test1,TableBody.ItemsSourceProperty,bx);
but that's not work- "ClearBinding" throws null pointer exception.
Is there any means to bind already binded TableBody to another XmlDocument(same XmlDataSource).By the way binding with "descendant::*" XPath binding dosen't works for multy-level "descendants"-remove XmlNode from XmlDataSource refresh TableBody UI only for first structured element:
<root>
<a>
<b>..</b>
</a>
<a>
<b>..</b>
</a>
</root>
remove "b"(that binded to TableRow) from second "a",dosen't refresh UI.
Regards. - Anonymous
September 04, 2005
Image Scaling
Attached properties
XAML Editing in an Xml Editor - major schema enhancement coming...