combobox problem
-
hi.. how do i get the value of the selected combobox item? i do like this below <ComboBox x:Name="email" SelectedValuePath="@ProgID" SelectedIndex="0" IsEnabled="{Binding Path=IsEnabled, ElementName=NewButton}" HorizontalAlignment="Left" Margin="317.228,236,0,0" VerticalAlignment="Top" Width="67" Height="20" :LayoutOverrides="HorizontalAlignment" SelectionChanged="email_SelectionChanged" > <ComboBoxItem IsSelected="true" Content="Email "/> <ComboBoxItem Content="Email 2"/> <ComboBoxItem Content="Email 3" </ComboBox> --------------------------------------------------------------------------------------------------------------------------------- ComboBoxItem email_selection; email_selection = email.SelectedItem as ComboBoxItem; string emailsel = email_selection.Content.ToString(); if (emailsel == "Email") { contact_email.Visibility = Visibility.Visible; contact_email2.Visibility = Visibility.Hidden; contact_email3.Visibility = Visibility.Hidden; } is it this way? but why the response alwasy come late.. only i click many times then it will response..
-
hi.. how do i get the value of the selected combobox item? i do like this below <ComboBox x:Name="email" SelectedValuePath="@ProgID" SelectedIndex="0" IsEnabled="{Binding Path=IsEnabled, ElementName=NewButton}" HorizontalAlignment="Left" Margin="317.228,236,0,0" VerticalAlignment="Top" Width="67" Height="20" :LayoutOverrides="HorizontalAlignment" SelectionChanged="email_SelectionChanged" > <ComboBoxItem IsSelected="true" Content="Email "/> <ComboBoxItem Content="Email 2"/> <ComboBoxItem Content="Email 3" </ComboBox> --------------------------------------------------------------------------------------------------------------------------------- ComboBoxItem email_selection; email_selection = email.SelectedItem as ComboBoxItem; string emailsel = email_selection.Content.ToString(); if (emailsel == "Email") { contact_email.Visibility = Visibility.Visible; contact_email2.Visibility = Visibility.Hidden; contact_email3.Visibility = Visibility.Hidden; } is it this way? but why the response alwasy come late.. only i click many times then it will response..
can you please post a full example of your XAML and Code behind. If it is huge, then juse extract the necessary pieces and post it here so I can give you a hand.
Cheers, Karl
» CodeProject 2008 MVP My Blog | Mole's Home Page | How To Create Screen Capture Videos For Your ArticlesJust a grain of sand on the worlds beaches.