Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

datatemplate for generic type is not working.

$
0
0

Hi. I have a generic type like that.

public class TestItem<T>
{
   public override string ToString()
   {
       return "TestItem";
   }
}

public class Test<T>
{
   public ObservableCollection<TestItem<T>> Items { get; set; }
}

And xaml.

<DataTemplate x:Key="{x:Type ns:Test`1}"><ComboBox Style="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type w:Control}, ResourceId=ComboBoxStyle}}" 
     ItemsSource="{Binding Path=Value.Items}" SelectedItem="{Binding Path=Value.SelectedItem, Mode=TwoWay}">                   </ComboBox></DataTemplate>
But i see only name of Test type and items in the combobox doesn't show up. And i have a warning in the xaml saying - "incorrect number if type parameter" for ns:Test`1.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>