Hi,
Make sure that the selected item in the "SelectedCenters" is an item from the ItemsSource "CostCenterFilter", not a new instance.
Here's my code-behind to work width your xaml :
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF
Make sure that the selected item in the "SelectedCenters" is an item from the ItemsSource "CostCenterFilter", not a new instance.
Here's my code-behind to work width your xaml :
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.DataContext = this;
this.CostCenterFilter = new ObservableCollection<MyData>()
{
new MyData() { LoadingCenterCode = 1 },
new MyData() { LoadingCenterCode = 2 },
new MyData() { LoadingCenterCode = 3 },
new MyData() { LoadingCenterCode = 4 },
new MyData() { LoadingCenterCode = 5 },
new MyData() { LoadingCenterCode = 6 },
new MyData() { LoadingCenterCode = 7 },
new MyData() { LoadingCenterCode = 8 },
new MyData() { LoadingCenterCode = 9 },
new MyData() { LoadingCenterCode = 10 },
};
this.SelectedCenters = new ObservableCollection<MyData>()
{
this.CostCenterFilter[3]
//new MyData() { LoadingCenterCode = 3 } //This doesn't work !
};
}
public ObservableCollection<MyData> CostCenterFilter
{
get;
set;
}
public ObservableCollection<MyData> SelectedCenters
{
get;
set;
}
}
public class MyData
{
public int LoadingCenterCode
{
get;
set;
}
}――――
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF