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

3 posts, 1 answers
  1. Ahmed
    Ahmed avatar
    55 posts
    Member since:
    Oct 2012

    Posted 07 Dec 2010 Link to this post

    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. Ahmed
    Ahmed avatar
    55 posts
    Member since:
    Oct 2012

    Posted 08 Dec 2010 Link to this post

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

     (((CheckBox)sender).DataContext as ItemStructure).ID
  3. DevCraft banner
  4. Answer
    Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 10 Dec 2010 Link to this post

    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
Back to Top