Maybe the following link could help you ;
http://stackoverflow.com/questions/1861475/marshal-struct-problem-with-c-sharp
I made a simple sample to test the "Clear" of the CheckComboBox.ItemsSource. Everything worked well. Here's the sample :
XAML :
<Window x:Class="TestToolkit.MainWindow"
</Window>
C# :
public class Person : DependencyObject
{
public partial class MainWindow : Window
{
http://stackoverflow.com/questions/1861475/marshal-struct-problem-with-c-sharp
I made a simple sample to test the "Clear" of the CheckComboBox.ItemsSource. Everything worked well. Here's the sample :
XAML :
<Window x:Class="TestToolkit.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:local="clr-namespace:TestToolkit"
x:Name="_demo"
Title="MainWindow" Height="800" Width="1200" >
<Grid><xctk:CheckComboBox ItemsSource="{Binding PersonList, ElementName=_demo }" DisplayMemberPath="Name"/>
</Grid></Window>
C# :
public class Person : DependencyObject
{
public string Name
{
get;
set;
}
public int ID
{
get;
set;
}
}public partial class MainWindow : Window
{
ObservableCollection<Person> _personList = new ObservableCollection<Person>();
public ObservableCollection<Person> PersonList
{
get
{
return _personList;
}
}
public MainWindow()
{
_personList.Add( new Person() { Name="Bob", ID=1});
_personList.Add( new Person() { Name="Tom", ID=2});
_personList.Add( new Person() { Name="Mark", ID=3});
_personList.Add( new Person() { Name="Brian", ID=4});
_personList.Add( new Person() { Name="Carey", ID=5});
_personList.Add( new Person() { Name="Scott", ID=6});
InitializeComponent();
}
protected override void OnKeyDown( KeyEventArgs e ){
base.OnKeyDown( e );
if( e.Key == Key.A )
{
PersonList.Clear();
PersonList.Add( new Person() { Name="Alan", ID=5});
PersonList.Add( new Person() { Name="Kevin", ID=6});
e.Handled = true;
}
}
So when the Key_A is pressed, the list used for the binding of the CheckComboBox is cleared and new entries are made. CheckComboBox has been updated without errors.