Click here to Skip to main content
15,903,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi to all



I have Created the combobox in wpf ,this Combobox Contains the Checkbox,

my requirement is to get the Checked Checkboxes Data which are in the combobox, i think you can understand my poor english

sample code for creating the checkbox in the Combobox :


<ComboBox Name="cmb" Margin="5" Height="23" Canvas.Left="98" Canvas.Top="251" Width="163" SelectionChanged="cmb_SelectionChanged">
                      <ComboBox.ItemTemplate>
                       <DataTemplate>
                       <StackPanel Orientation="Horizontal">
                           <CheckBox Margin="5" IsChecked="{Binding IsVisited}" Checked="CheckBox_Checked"/>
                           <TextBlock Margin="5" Text="{Binding CityName}"/>
                       </StackPanel>
                 </DataTemplate>
              </ComboBox.ItemTemplate>
            </ComboBox>



so i Need to retrive the Checked data from the Combobox,so please try to explain the Concept and giove me idea
Posted
Updated 22-Jul-11 5:18am
v2
Comments
Wjousts 22-Jul-11 11:17am    
It's not clear what you want here. What do you mean by "checked checkboxes data"? Do you mean find which item(s) are checked?

cmbfilter is the combobox name, just typecast it...
 
string cmbvalue="";
System.Windows.Controls.ComboBoxItem curItem=((System.Windows.Controls.ComboBoxItem)Cmbfilter.SelectedItem);
cmbvalue=curItem.Content;


Hope this helped...

--
AJ
 
Share this answer
 
You have a binding to a IsVisited property. The value of that property in the combobox data items should indicate whether the checkbox is checked or not (you may have to set the binding's mode to TwoWay).
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900