Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to show my Groupboxes and its controls with respect to the combobox selected value..

when i selected combobox selected event is executed and my switch cases are executing
but final output of group box visibility is wrong for me..

help me please!!
Posted
Comments
Thomas Duwe 12-Sep-12 4:12am    
without code to look at nobody can help you.
what are you doing in the selected event and what specifically is going wrong with the visibility of the groupbox?
[no name] 12-Sep-12 12:00pm    
I can't see anything wrong with any of the code that you 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;
           }
       }
   }


before executing this code on design level please group all the controls inside Groupbox to Grid. this will solve your problem.
if u want to display controls specifically inside groupbox then every control visibility need to be set
 
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