I have my class:
public class CustomCell
{
public string BindingData
{
get { return (string)GetValue(BindingDataProperty); }
set { SetValue(BindingDataProperty, value); }
}
public static readonly DependencyProperty BindingDataProperty =
DependencyProperty.Register("BindingData", typeof(string), typeof(CustomCell));
}
I set a binding with BindingDataProperty
CustomCell cell = new CustomCell();
cell.SetBinding(CustomCell.BindingDataProperty, new Binding("source"));
And now I want to get the XAML equivalent string using XamlWriter:
string xaml = XamlWriter.Save(cell);
But in the xaml string BindingData is {x:Null} and no any binding is done.
Why? How can I solve this problem?
It is a Serialization Limitation of XamlWriter.Save
See the MSDN documentation: