expander

ListView with nested Expander not collapsing

余生长醉 提交于 2019-12-06 00:59:56
问题 This question is the same as this other unanswered question. When the Expander is expanded the outer ListView grows to make space for the expanders contents, but when the Expander is then collapsed the view does not force the ListView to resize. Reduced code, with notes after: <!--<StackPanel>--> <ItemsControl> <!-- ParameterGroupView --> <Border BorderBrush="Brown" BorderThickness="1" CornerRadius="4" Padding="4"> <ListView HorizontalContentAlignment="Stretch"> <Expander Header="Expander A"

How to align TexBlocks in WPF Expander Header

这一生的挚爱 提交于 2019-12-05 10:39:24
I have Multiple Texblock in Expander Header. I want these TextBlocks aligned to Left, Right and Center. How can i achieve this? Please Help... Thanks Sharath The Text in Red should be left aligned, the one in blue should be center aligned and the green should be right aligned Please copy the code in XAMLPad.Exe The reason that you can't simply use a Grid or Dock panel with the TextBlocks in to control the alignment is because the default template of Expander left aligns the header content instead of allowing it to stretch. There are two ways around this. You can either specify a width for the

Put resizable Expander to expand from right to left

て烟熏妆下的殇ゞ 提交于 2019-12-05 10:20:26
I would like to have the Expander from question below (see the accepted answer) which is a perfect solution for me. I just want to have it on the right side. Combine expander and grid (resizable expander) To have it expanded from right to left I changed the settings for an analoguous behavior. (I emphasized elements to see better what's going on): <Expander Grid.Column="1" Header="Test" ExpandDirection="Left" BorderThickness="10" BorderBrush="Black" HorizontalAlignment="Right" > <Expander.Content> <Grid > <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"

WPF - Expand Window to the Left

邮差的信 提交于 2019-12-05 05:35:38
I have a WPF window with expandable panel (via Expander ). The panel is on the left side of the window, and when expanded the window grows to fit the content. By default, windows are anchored to the top-left, so my window grows to the right. I'd like the window to grow to the left. I tried to do the following in the Window.SizeChanged event: private void onWindowSizeChanged(object sender, SizeChangedEventArgs e) { Left -= (e.NewSize.Width - e.PreviousSize.Width) } and it works, but the growth is jerky, and I'd like to find a smoother solution. I managed to overcome this using a simple solution

Preventing a WPF Expander from expanding when header is clicked

不打扰是莪最后的温柔 提交于 2019-12-05 00:35:19
How can I prevent a WPF Expander from expanding when its header is clicked? I would like my Expander to expand or collapse only when the expand button itself is clicked. I imagine the answer has something to do with canceling a bubbled event. If possible I would like to implement the solution in XAML while avoiding retemplating the entire Expander . The header is the button that creates the event, so you need to change the template for your Expander to just have the expander icon as the button. Here is a post of how to change the expander . There is actually a much simpler XAML solution than

WPF Expanders Triggers

倾然丶 夕夏残阳落幕 提交于 2019-12-04 19:39:26
I have 2 expanders side by side. Only 1 can be opened at a time. I want to write Triggers for them directly in their definition like this: <Expander x:Name="MenuOverView" ExpandDirection="Left"> <Expander.Triggers> <Trigger Property="IsExpanded" Value="False" SourceName="MenuDetailed"> <Setter Property="IsExpanded" Value="True" TargetName="MenuOverView" /> </Trigger> </Expander.Triggers> </Expander> <Expander x:Name="MenuDetailed" ExpandDirection="Right"> <Expander.Triggers> <Trigger Property="IsExpanded" Value="False" SourceName="MenuOverView"> <Setter Property="IsExpanded" Value="True"

Reset Expander to default collapse behavior

爷,独闯天下 提交于 2019-12-04 18:16:29
I'm using an expander inside a Resizer (a ContentControl with a resize gripper), and it expands/collapses properly when the control initially comes up. Once I resize it, the Expander won't properly collapse, as documented below. I ran Snoop on my application, and I don't see any heights set on Expander or its constituents. How would I go about convincing Expander to collapse properly again? Or modifying Resizer to not make Expander sad would work as well. Expander documentation says: "For an Expander to work correctly, do not specify a Height on the Expander control when the ExpandDirection

Expander combined with GridSplitter

柔情痞子 提交于 2019-12-04 13:00:05
I’m trying to split my WPF window into two “areas”, top and bottom. The top area contains a grid. The bottom area contains an expander. Between the two areas should be a GridSplitter which the user can use to resize the areas. The content of each area should use the full high of the area. By default, the expander is expanded. When the user closes the expander, the bottom area should reduce its height to the height of the collapsed expander. This is my code: <Window x:Class="App.Shell" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx

WPF Listbox + Expander events

点点圈 提交于 2019-12-04 12:58:50
问题 I have an Expander in the ItemTemplate of a ListBox. Renders fine. The issue I have run into is that I would like the ListBox_SelectionChanged event to fire when the expander is expanded and/or selected. The MouseDown event does not seem to bubble up to the ListBox. What I need is the SelectedIndex of the ListBox. Because the ListBox_SelectionChanged does not get fired, the index is -1 and I cannot determine which item has been selected. The ListBox_SelectionChanged Event is fired if a user

WPF: Creating a ListView with expanding ListItems

久未见 提交于 2019-12-04 11:20:59
So I want a list of items that when you select them they expand to show more info (no toggleButton). I figure there are multiple ways to do this but what I started at was that I had a ListView bound to the collection of viewModels and then defined the ViewModel view as Expander. Problem here was binding the selected one to be expanded. I started getting multiple ideas on how this could be done differently. Perhaps modding the ControlTemplate of the ListView to have it's items set as my own type of expander. But I'm not sure how well that works when the ItemsSource is set for the list. Problem