Thursday 15 September 2011

Closing just one expander within another expander in WPF/ VB.NET -


First of all, if I'm doing something wrong / I am working with a WPF application in Visual Studio 2010 and VB.NET I am using.

So I have a parent extension that has a grid with two controllers: one more expander and another grid I wrote some code for some expander to disappear when it is collapsing or Closed (among some other things), and changing colors / when it is expanded / opened, I have some buttons in other buttons that fulfill the same task. My problem is that when I am going to expand another, the 1 (parent) expander also stops / disappears, however, a button that is used to throw the other extensioner, it works perfectly Does. Here's my relevant code (hopefully I'm doing this right formatting):

XAML

  & lt; Expander name = "Expander1" visibility = "hidden" & gt; & Lt; Grid & gt; & Lt; Grid.RowDefinitions & gt; & Lt; RowDefinition Height = "Auto" /> & Lt; RowDefinition Height = "Auto" /> & Lt; /Grid.RowDefinitions> & Lt; Expander Name = "Expander 2" Visibility = "Hidden" & gt; & Lt; Content ... & gt; & Lt; / Expander & gt; & Lt; Grid & gt; & Lt; Grid.RowDefinitions & gt; & Lt; Roadfinion height = "20" /> & Lt; /Grid.RowDefinitions> & Lt; Content ... /> & Lt; / Grid & gt; & Lt; / Grid & gt; & Lt; / Expander & gt;   

VB.NET

  private sub Expander2_Expanded (ByVal System.Object as the sender, ByVal e Expander2 as System.Windows.RoutedEventArgs). Expanded Expander2 handles. Background = brush.PoltquyEx Expander 2.Bowderbrush = Brush The Black and Sub Private All Explorer handles 2_Collapsed (as the system., By the sender, as the system. Virtual RootedAventAge) Expander. Collapsed Expander2.Isxanded = False Expander2.Background = Brushes.Transparent Expander2.BorderBrush = Brushes.Transparent Expander2.Visibility = Windows.Visibility.Visible ButtonA7.Visibility = Windows.Visibility.Visible Expander1.IsExpanded = True Expander1.Background = Brushes.PaleTurquoise Expander1.BorderBrush = Brushes.Black Expander1.Visibility = Windows Visibility.Visible End Sub Private Sub Expander1_Expanded (ByVal) handles Expander1.Expanded Expander1.Background = Brushes.PaleTurquoise Expander1.BorderBrush = Brushes.Black End Sub Private in as the System.Object, ByVal e System.Windows.RoutedEventArgs Deputy Expander1_Collapsed (ByVal in as the System.Object, ByVal e System.Windows.RoutedEventArgs) handles Expander1.Collapsed Expander1.Background = Brushes.Transparent Expander1.BorderBrush = Brushes.Transparent Expander1.Visibility = Windows.Visibility.Hidden ButtonA7 Visibility = windows Visibility Visual and all   

Do not worry about all the buttons in the code, buttons work fine. Actually, a button is about to stretch the same thing, and it works properly. I need only that thing when you click on the actual expander it will fall. Here the button code so you can see it is the same:

  private sub Button_Click_2 (ByVal) Expander2.IsExpanded as the System.Object, as ByVal e System.Windows.RoutedEventArgs = false Expander2.Background = Brushes.Transparent Expander2.BorderBrush = Brushes.Transparent Expander2.Visibility = Windows.Visibility.Visible Expander1.IsExpanded = true Expander1.Background = Brushes.PaleTurquoise Expander1.BorderBrush = Brushes.Black Expander1.Visibility = Windows. Visibility Visible ButtonA7.Visibility = Windows.Visibility.Visible End Sub   

Thank you for any help, so I really appreciate it

Edit: if there are optional By the way! An easy way (I'm too new to WPF ... ~ 1week) to hide / hide the header, whatever works, but I like it in another way where I tried earlier, If possible. Thanks!

Routing strategy is handled as Bubbling Mark's event before it reaches Expander1 and all should be fine.

  private sub Expander2_Collapsed (ByVal as from as System.Object, ByVal e System.Windows.RoutedEventArgs) handles Expander2.Collapsed .. E.Handled = True End Sub    

No comments:

Post a Comment