I'm trying to bind my elements in a datatemplate that is define in dictionary. Let's make it simple.
I have a simple class
public class A { public string Data {get;set} } I have a simple view that contains a ListBox, with ItemSources is a list of class A :
<ListBox ItemsSource="{Binding AList}"> The point is, when I define Itemplate in view directly, bind works :
<ListBox.ItemTemplate> <DataTemplate > <TextBlock Text="{Binding Data}" /> <Rectangle Fill="Red" Height="10" Width="10"/> </DataTemplate> </ListBox.ItemTemplate> This works great.
But when I define this ItemTemplate in resource Dictionary, binding doesn't works ?
How can I do that ?
PS : This is a simple example to explain my problem, don't tell me to override toString function to make it works or use classe template, my real case is very more complexe than this.
Thanks for help