I am trying to force an object to be an example method but only me the properties or the static methods. Here is the relevant part of my code:
& lt; window. Resources & gt; & Lt; ObjectDataProvider x: key = "identifier" method name = "getIdentifier" object type = "{x: type itself: partial mode}" /> & Lt; /Window.Resources> & Lt; ItemsControl.ItemTemplate & gt; & Lt; DataTemplate & gt; & Lt; Grid margin = "0,0,0,5" & gt; & Lt; Grid.ColumnDefinitions & gt; & Lt; Column width = "20" /> & Lt; Column width = "80" /> & Lt; /Grid.ColumnDefinitions> & Lt; Text block text = "{binding identifier}" grid Column = "0" /> & Lt; Text block text = "{binding title}" grid. Column = "1" /> & Lt; / Grid & gt; & Lt; / DataTemplate & gt; & Lt; /ItemsControl.ItemTemplate>
PartModel
is an item that I use to fill itemscontrol. The title
appears and when I call it in my regular code, the getIdentifier
method works but in my view only shows the title for the identifier and the column remains blank is.
Is it possible or do I have to write the identifier for the property of the model?
You are currently bound to an identifier
property, which is in your list The item does not exist on the datacontext object.
Instead of the binding source
object, set the ObjectDataProvider resource in the context of the identifier
resource key:
& Lt; TextBlock Text = "{Binding Source = {Static Resources Identifier}}" />
No comments:
Post a Comment