Hello! I was trying to get advantage from the RadTabControl component in my project and have it bounded to a collection I am going to use. I follow all the steps in the documentation, but in the end the tab names are still the name of the class and not some property string I want to use. I even made a project using your own classes (Person & ViewModel) thinking that something is wrong with my code and I still see "DataInfo.Person" at the name of each tab (DataInfo is my namespace)
I am using exactly your code:
namespace DataInfo { |
public class Person { |
public Person( string name, int age ) { |
this.Name = name; |
this.Age = age; |
} |
public string Name { |
get; |
set; |
} |
public int Age { |
get; |
set; |
} |
} |
} |
namespace DataInfo { |
public class ViewModel { |
public ViewModel() { |
this.Persons = new ObservableCollection<Person>(); |
this.Persons.Add( new Person( "Ivan", 23 ) ); |
this.Persons.Add( new Person( "Stefan", 34 ) ); |
this.Persons.Add( new Person( "Maria", 16 ) ); |
this.Persons.Add( new Person( "Michael", 78 ) ); |
} |
public ObservableCollection<Person> Persons { |
get; |
set; |
} |
} |
} |
<UserControl x:Class="DataInfo.TabControl" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:DataInfo="clr-namespace:DataInfo" |
xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"> |
<UserControl.Resources> |
<DataInfo:ViewModel x:Key="DataSource" /> |
<DataTemplate x:Key="ContentTemplate"> |
<Grid> |
<TextBlock Text="{Binding Age}" /> |
</Grid> |
</DataTemplate> |
</UserControl.Resources> |
<Grid x:Name="LayoutRoot" |
Background="White"> |
<Controls:RadTabControl x:Name="radTabControl" |
Margin="8" |
ItemsSource="{Binding Source={StaticResource DataSource}, Path=Persons}" |
DisplayMemberPath="Name" |
ContentTemplate="{StaticResource ContentTemplate}" /> |
</Grid> |
</UserControl> |
Is there something I've misunderstood?
Thank you!
Roxana