Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more: , +
Dear Experts,

In my WPF project we are using WPF Extended toolkit version 1.8.0

Here i have taken CheckComboBox in XAML Like Below

XML
<xctk:checkcombobox height="20" name="LocaleSelector"                              Margin="226,12,26,429" ItemSelectionChanged="LocaleSelector_ItemSelectionChanged"> </xctk:checkcombobox>


Then in my code view we are binding with the database.
C#
public void BindComboBox()
        {
            try

            {
                SqlConnection conn = new SqlConnection(str);
                SqlDataAdapter da = new SqlDataAdapter("select Department_Name from Dept", conn);
                DataSet ds = new DataSet();
                da.Fill(ds, "dept");
                Selector sel = new Selector();
                LocaleSelector.Items.Add("All");
               if (ds.Tables["dept"].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables["dept"].Rows)
                    {
                     LocaleSelector.Items.Add(dr["Department_Name"]);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

This code is working fine. but we need that when user selects All from the checkcombobox then we want disable or make readonly or something else for remaining items from the checkcombobox and vice-versa.

Please provide me your valuble ideas to implement this.
Posted
Updated 24-Feb-13 17:30pm
v12
Comments
Thomas Duwe 29-Jan-13 3:11am    
How about listening to the Selected/Unselected event of the CheckComboBox and if the 'All' item is selected(checked), then
set IsEnabled=false for all other items and optionally remove all other items from the SelectedItems property of the CheckComboBox.
That's really not the best way but it should work.
Matt T Heffron 11-Feb-13 13:39pm    
It might be easier, both for you AND for the user, if, instead of having the All selection disable everything else in the list, just have everything else in the list unselect All.

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