Hi
I am using a Telerik radcombobox in a ItemsControl like below. The itemscontrol is populated with some data, and I want the combobox to be default selected to one of the fields in the data. Why doesn't this work?
Data:
I am using a Telerik radcombobox in a ItemsControl like below. The itemscontrol is populated with some data, and I want the combobox to be default selected to one of the fields in the data. Why doesn't this work?
<Window.Resources> <CollectionViewSource x:Key="orderViewSource" /></Window.Resources><Grid> <ItemsControl x:Name="rptOrders" ItemsSource="{Binding Source={StaticResource orderViewSource}}"> <ItemsControl.ItemTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="160px" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <Label Content="{Binding Path=Name}" Grid.Column="0" VerticalAlignment="Center"></Label> <telerik:RadComboBox x:Name="rcbOrder" Grid.Column="1" SelectedItem="{Binding Path=Order}"> <telerik:RadComboBoxItem Content="Extra Hot" /> <telerik:RadComboBoxItem Content="Hot" /> <telerik:RadComboBoxItem Content="Mild" /> </telerik:RadComboBox> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl></Grid>Data:
((CollectionViewSource)(FindResource("orderViewSource"))).Source = Data.StaffOrders;public class Data{ public static ObservableCollection<StaffMember> StaffOrders { get { return //loaddata; } } public class StaffMember { public Int32 StaffID { get; set; } public String Name { get; set; } public String Email { get; set; } public String Order { get; set; } }}