Click here to Skip to main content
15,795,581 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
private void combogroup_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

------binded combobox
------

   category ca = new category();
            strCurCatGroup = combogroup.SelectedValue.ToString().Trim();
            ca.changecategory(strCurCatGroup);//change category is my method

        }

 private void changecategory(string strCategoryGroup)
        {

switch(---)
{
case "A":
groupbox1.visibility=Visibility.Hidden;
groupbox2.visibility=Visibility.Visible;

--
case 2:

groupbox1.visibility=Visibility.Visible;
groupbox2.visibility=Visibility.Hidden
//groupbox 1 and grpbox 2 contain different controls and i am able to execute the cases properly but the result is not getting.
}
Posted

1 solution

C#
public partial class MainWindow : Window
   {
       public MainWindow()
       {
           InitializeComponent();
       }

       private void Window_Loaded(object sender, System.Windows.RoutedEventArgs e)
       {
           cmbnum.Items.Add("1");
           cmbnum.Items.Add("2");
       }

       private void cmbnum_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
       {
           if(cmbnum.SelectedItem == "1")
           {
               grp1.Visibility = Visibility.Hidden;
           }
           else
           {
               grp1.Visibility = Visibility.Visible;
           }
       }
   }


put all the controls inside a grid in Groupbox your problem will be solved.
 
Share this answer
 

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