This is a migrated thread and some comments may be shown as answers.

Help with binding the checkbox in DataboundListbox

2 Answers 66 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
GJ Kuz
Top achievements
Rank 1
GJ Kuz asked on 19 Jan 2012, 05:35 AM
Dear Telerik Team,

Is it possible to bind the checkbox in the DataboundListbox? I am using the following datatemplate as the ItemTemplate of the RadDataboundListbox.
<phone:PhoneApplicationPage.Resources>
        <DataTemplate x:Key="ListBoxItemTemplate">
            <Grid HorizontalAlignment="Stretch" Width="420">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100" />
                    <ColumnDefinition Width="*" />                                  
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="50*"/>
                    <RowDefinition Height="50*"/>
                </Grid.RowDefinitions>
 
                
                <CheckBox
                    IsChecked="{Binding IsFavorite, Mode=TwoWay}"
                    Grid.Column="0" Grid.RowSpan="2" VerticalAlignment="Top"/>
 
                <TextBlock
                    Text="{Binding Title}"
                    FontSize="{StaticResource PhoneFontSizeLarge}"
                    Grid.Column="1"                    
                    VerticalAlignment="Top"
                    Margin="-36, 12, 0, 0"/>
 
                <TextBlock
                    Text="{Binding Description}"
                    FontSize="{StaticResource PhoneFontSizeMedium}"
                    Grid.Column="1"
                    Grid.Row="1"                    
                    VerticalAlignment="Top"
                    Margin="-36, 12, 0, 0"
                    TextWrapping="Wrap"/>
            </Grid>
        </DataTemplate>
    </phone:PhoneApplicationPage.Resources>

This is my RadListbox. By default I want the checkboxes to be visible. Is there any way I could eliminate the Checkbox from my DataTemplate and bind the IsFavorite property to the built-in checkbox in RadDataBouldListbox? I would prefer to use the built-in checkbox since I am using the ItemCheckedStateChanging event.

 

<telerikPrimitives:RadDataBoundListBox
               x:Name="lstItems"
               Margin="-10,0,-12,0"
               CheckModeDeactivatedOnBackButton="False"
               EmptyContent=""                
               IsCheckModeEnabled="True"
               IsCheckModeActive="True" 
               ItemsSource="{Binding Items}" 
               Grid.Row="1"
               ItemTemplate="{StaticResource ListBoxItemTemplate}"
               ItemCheckedStateChanging="lstItems_ItemCheckedStateChanging"/>

Really appreciate some help on this.

thanks,
Gilles

2 Answers, 1 is accepted

Sort by
0
Accepted
Todor
Telerik team
answered on 20 Jan 2012, 10:37 AM
Hello Gilles,

Thank you for your question.

If you want to use the built-in checkbox, you can use the ItemCheckedPath property. In your case you should simply add
ItemCheckedPath = "IsFavorite"

I hope this helps. Have a great day!

Greetings,
Todor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
GJ Kuz
Top achievements
Rank 1
answered on 20 Jan 2012, 01:59 PM
Thank you Todor. That worked like a charm.

thanks,
Gilles
Tags
DataBoundListBox
Asked by
GJ Kuz
Top achievements
Rank 1
Answers by
Todor
Telerik team
GJ Kuz
Top achievements
Rank 1
Share this question
or