lundi 28 mars 2016

Telerik RADListBox with CheckBox - How to trigger a checked item in checkbox to call its RADListBox SelectedValue event

I am having a UI problem with RadListBox and checking items in a Checkbox. The issue is that my selection in the checkbox wont trigger an event since its the selection in the RADListBox that triggers it. And the user needs to check the Checkbox and then select (click) the item in the radlistbox to trigger the SelectedValue event of it. I would like to have it so that when the user checks a checkbox the Selectedvalue event of the RadListBox gets called too. Here is my WPF code:

<telerik:RadListBox  Grid.Row="1" x:Name="ExportersList" ItemsSource="{Binding Exporters}" Style="{StaticResource ModalListBoxStyle}"
           Visibility="{Binding ExportComplete, Converter={StaticResource InverseBoolToVisibilityConverter}}"
           SelectedValue="{Binding ExportFormatName, Mode=TwoWay}" SelectedValuePath="Name" SelectionMode="Multiple">
            <telerik:RadListBox.ItemTemplate>
                <DataTemplate DataType="{x:Type interfaces:BaseTourSheetExporterType}">
                    <StackPanel Orientation="Horizontal">
                        <CheckBox IsChecked="{Binding IsExporterChecked}" />
                        <TextBlock Text="{Binding Name}"  Margin="5" />
                    </StackPanel>
                </DataTemplate>
            </telerik:RadListBox.ItemTemplate>
        </telerik:RadListBox>

Please note that the event SelectedValue is bound to a property in my class and when it gets/sets I am enabling/disabling another button. I don't know how to get my Checkbox IsChecked event (when a user checks or unchecks the checkbox) to trigger the selectedvalue event of the radlistbox and basically allowing my user to just check/uncheck a Checkbox that triggers another get/set property (ExportFormatName). So this way the user can do it without selecting the item again in the radlistbox (clicking outside the checkbox) to trigger that get/set property event. Please help me with this WPF part.

Just to note aside of this, I'm purposely binding the CheckBox IsChecked to a class called BaseTourSheetExporterType that is holding a member Boolean value (IsExporterChecked). This determines whether its been checked or not (this class and member is required to remember my changes for when I'm re-opening the window).




Aucun commentaire:

Enregistrer un commentaire