Checkbox in item isn't checked

3 posts, 0 answers
  1. Gilbert van Veen
    Gilbert van Veen avatar
    74 posts
    Member since:
    Oct 2009

    Posted 02 Mar 2011 Link to this post


    I have a radcombobox with items which are filled by my own routine.
    In the combobox there is a context menu with two options:

    - Check all
    - Uncheck all

    When I select one of the above I want to itterate trough the items and set the checkbox to true or false. I call my routine and I see that the Entitype.IsChecked is set but the checkbox in the combobox isn't updated?

                                        x:Name="Tra_EntityTypeList" Width="150" Height="25" HorizontalAlignment="Left" Tag="EntityList" 
                                        ClearSelectionButtonContent="None" IsEnabled="True" FontStyle="Italic" EmptyText="Selection" MaxDropDownHeight="225" DropDownClosed="ItemsChecked">
                                    <DataTemplate x:Name="EntityTemplate">
                                        <Grid Margin="0" Width="200">
                                                <ColumnDefinition Width="25"/>
                                                <ColumnDefinition Width="175" />
                                                <RowDefinition />
                                            <CheckBox Grid.Column="0" Margin="0" Name="CheckBoxForEntityType" IsChecked="{Binding IsChecked, Mode=TwoWay}"/>
                                            <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Description}" Tag="EntityType">
                                                <!--Context menu-->
                                                    <telerik:RadContextMenu Opened="RadContextMenu_Opened" ItemClick="RadContextMenu_ItemClick">
                                                            <telerik:RadMenuItem Header="Select all" Tag="EntSelectAll" />
                                                            <telerik:RadMenuItem Header="Select none" Tag="EntSelectNone" />

    The code behind is:

    switch (_Type)
                    case "EntityType":
                        int i = 0;
                        foreach (EntityType MySelectedEntityType in Tra_EntityTypeList.Items)
                            MySelectedEntityType.IsChecked = true;

    I hope someone can help me with this.
  2. Yana
    Yana avatar
    5044 posts

    Posted 07 Mar 2011 Link to this post

    Hello Gilbert van Veen,

    You should implement INotifyPropertyChanged interface in order to notify that IsChecked property has been changed and thus to force the combobox items to take the new value. I've attached an example based on your code to demonstrate the approach.

    All the best,
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. Gilbert van Veen
    Gilbert van Veen avatar
    74 posts
    Member since:
    Oct 2009

    Posted 08 Mar 2011 Link to this post


    Many thanks!! I totally forgot to use the INotifyChanged option.

    It works perfect!.

Back to Top