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

Structered Rad Combo Box (Multi Selection) How Can I get ID Value or Selected Item??

2 Answers 133 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Ahmed
Top achievements
Rank 1
Ahmed asked on 07 Dec 2010, 11:26 PM
I created Multi Selection Rad Combo Box (Structured Rad Combo Box) as Below
<telerik:RadComboBox HorizontalAlignment="Left" Margin="99,190,0,0" Name="radComboBox1" VerticalAlignment="Top" Width="250">
            <telerik:RadComboBox.ItemTemplate>
                <DataTemplate>
                    <CheckBox Content="{Binding Path=Text}" Checked="{Binding Path=Selected}" Height="16" HorizontalAlignment="Left" Margin="2" VerticalAlignment="Top" />
                </DataTemplate>
            </telerik:RadComboBox.ItemTemplate>
        </telerik:RadComboBox>

and I Define The Structure for That Rad Combo Box In .CS Class Like That :
public class ItemStructure 
    public int ID { get; set; } 
    public string Text { get; set; } 
    public bool Selected { get; set; } 
}
and I Created Rad Combo Box Items and Pass It in Page Constructor:
source.Add(new ItemStructure() { ID = 1, Text = "Man UTD", }); 
source.Add(new ItemStructure() { ID = 2, Text = "Barcelona", Selected = true }); 
source.Add(new ItemStructure() { ID = 3, Text = "Real Madrid", }); 
source.Add(new ItemStructure() { ID = 4, Text = "Milan", Selected = true }); 
source.Add(new ItemStructure() { ID = 5, Text = "Inter", }); 

radComboBox1

 

.ItemsSource = source;

 

 

It Works Fine But I want when i Check or Uncheck Combo Box in Check and Uncheck Event i want to get Current Item For Checked CheckBox or Get ID Value For The Current Checked So How Can I handle It ???????????????



2 Answers, 1 is accepted

Sort by
0
Ahmed
Top achievements
Rank 1
answered on 08 Dec 2010, 09:38 AM

We Can Access It By Call DataContext in CheckBox Events as Code Shown Below

 (((CheckBox)sender).DataContext as ItemStructure).ID
0
Accepted
Konstantina
Telerik team
answered on 10 Dec 2010, 10:32 AM
Hello Ahmed,

We are glad that you have resolved the issue yourself.

Please let us know if you have more questions.

Kind regards,
Konstantina
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
ComboBox
Asked by
Ahmed
Top achievements
Rank 1
Answers by
Ahmed
Top achievements
Rank 1
Konstantina
Telerik team
Share this question
or