Is there a way to customize the XAML serialization of a class I have public properties I do not want serialized (things like the Parent property in WPF classes). In other cases I would like to serialize a reference to another object and restore that at the other end. I can have duplicate properties holding the ids and recreate the object references after loading the XAML, but I still need to get the object reference properties excluded from the XAML. I would really rather not use get/set methods just to deal with serialization. Ideally there should be some attribute I can place on the properties in question.

XamlWriter customization?
Scott M.
You can do this the same way you do it in WinForms -- by putting the DefaultValueAttribute on your property (specifically, the CLR wrapper), or by defining a public method ShouldSerializeFoo (for a property named Foo):
[DefaultValue(null)]
public Type Foo
{
get {}
set {}
}
public bool ShouldSerializeFoo() {}
(We currently also support private ShouldSerialize methods, but that doesn't work with partial trust so we're dropping support for private ones)
In this most recent CTP, you can also use TypeDescriptor to customize which properties & what values should be serialized for a class.
Lions
manukahn
shya
cornzy
This seems to be a largely undocumented area of the API at this point and I have not played with it at all myself, but it looks like all the classes you need are in the System.Window.Serialization namespace. Just by looking at it, you would mark your type with the XamlDesignerSerializerAttribute and point to the custom XamlSerializer implementation for your type. If you're type is more like a value than an element, then you use the ValueSerializerAttribute and implement a custom ValueSerializer.
Like I said, I have no real experience with doing this myself at this point, but hopefully this will get you started down the right path.
HTH,
Drew
Lord Kaos