I wanna make a databinding in a custom class.
But it seems different from normal databinding.
For example, I have a custom class DisplayInfo with a properties DisplayText(string), DisplayStyle(string) and DisplayDescription(string).
and in another custom class ViewUI that contains a property DisplayData which is of type DisplayInfo.
for example:
public class ViewUI
{
....
public DisplayInfo DisplayData { get; set; }
....
}
I want to do DataBinding of the DisplayText in the Xaml. How could I do so?
reference:
<Page ......>
.....
.....
.....
<ViewUI .......>
<ViewUI.DisplayData>
<DisplayInfo Description="Description 123456...." DisplayStyle="Style123" DisplayText = "{Binding.....}"/> <!-- (How to do databinding here or in other place?) -->
</ViewUI.DisplayData>
</ViewUI>
</Page>
You have to change properties in custom class to dependency properties. If property of your class is dependency property then you are able to bind it in xaml.
For more info about dependency property visit http://msdn.microsoft.com/en-us/library/ms753358.aspx