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

RadDropDownButton filled with a list of checkboxes

1 Answer 133 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Rafael Moreno del Pino
Top achievements
Rank 1
Rafael Moreno del Pino asked on 23 Apr 2010, 11:29 PM
Hello,

     I would like a RadDropDownButton with a list of checkboxes inside. So I have tried to ways of doing it: with a ListBox and with a RadGridView as a container for that list of checkboxes.

    Both ways work well, but problem is that I would like that if I check the first item (called "ALL"), all the checkboxes were checked.

 <telerik:RadDropDownButton x:Name="cbSalesRep" Grid.Row="0" Grid.Column="0"  DropDownButtonPosition="Right" DropDownMaxHeight="300" DropDownWidth="150"  DropDownMaxWidth="150" ToolTipService.ToolTip="Choose Sales Rep..." 
                                        Height="25" Width="150" HorizontalAlignment="Left" Margin="26,15,22,0" TabIndex="11" telerik:StyleManager.Theme="Windows7" VerticalAlignment="Center"
                            <telerik:RadDropDownButton.DropDownContent> 
                                <telerikGridView:RadGridView x:Name="y" ItemsSource="{Binding SalesRepList, Mode=TwoWay}" ActionOnLostFocus="None" IsReadOnly="True" EditTriggers="None" GridLinesVisibility="None" ShowColumnHeaders="False"  
                                                            ShowGroupPanel="False" RowIndicatorVisibility="Collapsed" CanUserDeleteRows="False" CanUserInsertRows="False"  
                                                            CanUserSelect="False"  AutoGenerateColumns="False"
 
                                    <telerikGridView:RadGridView.Columns> 
                                        <telerikGridView:GridViewDataColumn Header="Activity" Width="*" Background="Transparent"
                                            <telerikGridView:GridViewDataColumn.CellTemplate> 
                                                <DataTemplate> 
                                                    <CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay}" Content="{Binding Name}"/> 
                                                </DataTemplate> 
                                            </telerikGridView:GridViewDataColumn.CellTemplate> 
                                        </telerikGridView:GridViewDataColumn> 
                                         
                                         
                                    </telerikGridView:RadGridView.Columns> 
                                   
                        </telerik:RadDropDownButton> 

So the gridview itemsource is SalesRepList (ViewModel), which is a Collection of items of the class SalesRep (Model), that has the property IsChecked as one of its parameters.

So I don't have SalesRep in the ViewModel, therefore I cannot use RaisePropertyChanged, and my checkboxes don't update it's value in the view!

All the examples I have seen so far were made binding the IsChecked to a property in the VM, but I cannot do that! (I have tried to bind the IsChecked to a property in the VM but it doesn't bind. Maybe because of the bind of the RadDropDownButton where the GridView is?

Any ideas?


1 Answer, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 28 Apr 2010, 01:53 PM
Hello Rafael,

I've attached a sample project that offers one possible solution to this scenario. Have a look at it and let me know how it works for you. I'd be glad to further assist you.

Kind regards,
Kiril Stanoev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Buttons
Asked by
Rafael Moreno del Pino
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Share this question
or