This project has moved. For the latest updates, please go here.

CheckListBox and ItemsSource

Apr 9, 2013 at 5:29 AM
I want to use CheckListBox and bind its ItemsSource to an ObservableCollection.

This is the XAML:
<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:tk="http://schemas.xceed.com/wpf/xaml/toolkit"
        Title="MainWindow" Height="350" Width="525">
    <StackPanel>
        <Button Click="AddClick">Add</Button>
        <tk:CheckListBox ItemsSource="{Binding ListItems}"></tk:CheckListBox>
    </StackPanel>
</Window>
And this is the code-behind:
namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public ObservableCollection<string> ListItems { get; set; }

        public MainWindow()
        {
            InitializeComponent();

            this.DataContext = this;

            ListItems = new ObservableCollection<string>();
        }

        private void AddClick(object sender, RoutedEventArgs e)
        {
            ListItems.Add("string");
        }
    }
}
When I click the Add button in my UI, it crashes in the AddClick method with the following error:
The runtime has encountered a fatal error. The address of the error was at 0xeb40f4f4, on thread 0x1414. The error code is 0x80131623. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
Is this a bug or am I doing something wrong? My code is pretty straight forward. If I change the CheckListBox to regular ListBox everything works...

Thanks!
Dina
Developer
Apr 9, 2013 at 6:37 PM
This issue is fixed in v2.0 of the toolkit.
Apr 23, 2013 at 11:41 AM
BoucherS wrote:
This issue is fixed in v2.0 of the toolkit.
Hi,

Could you please indicate when v2.0 will be available? I received the same type of error. Version I'm using: 1.9.0.0

Kind regards,