expander

Hide Expander ToggleButton if no child items in WPF

試著忘記壹切 提交于 2019-12-23 02:38:19
问题 I am using an expander control inside the Listbox to show a Hierarchical list of items and i am getting the visibility correctly. Here is the code i used in xaml to bind the data <Window.Resources> <ControlTemplate x:Key="WithoutToggleButton" TargetType="{x:Type Expander}"> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="3" SnapsToDevicePixels="True"> <ToggleButton x:Name=

Expander with animation that support all direction

此生再无相见时 提交于 2019-12-22 17:55:26
问题 My Objective: is to create a Custom Expander with Animation on expanding and should support for all the directions. What I tried: I have Implemented a solution with the help of this. I modified it and made it work based on my need. My solution will work with Up and I can able to make it work even with Down Direction. Whats my problem now: I couldn't make it work with all Directions. I tried and failed to make it work on setting ExpanderDirection to Left and Right . Here is my solution:

WPF Expanders Triggers

拜拜、爱过 提交于 2019-12-22 00:42:54
问题 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

WPF: Creating a ListView with expanding ListItems

谁说我不能喝 提交于 2019-12-21 17:55:37
问题 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

WPF Expander Button Styled so it is inside Expander Header

十年热恋 提交于 2019-12-20 10:10:15
问题 I am using the Expander control and have styled the header as shown in the picture below: http://www.hughgrice.com/Expander.jpg The problem I have is that I want the expander button to be contained within the header so that the line for the end of the header template aligns with the Expander content i.e. I ultimatly want to end up with something similar to the image below: http://www.hughgrice.com/Expander.gif Thanks in advance. 回答1: I see that you want to actually move the expander button

ListView jumps or does not shrink

送分小仙女□ 提交于 2019-12-19 09:04:23
问题 First had the problem with collapse of Expander not giving back space. Based on the borders it appears to be the ListView is not shrinking rather than the Expander not shrinking. The following code fixed the shrinking problem. From ListBox control does not shrink This loses virtualization but I am OK with that as this is as much data as I need to display. <ListView.ItemsPanel> <ItemsPanelTemplate> <StackPanel/> </ItemsPanelTemplate> </ListView.ItemsPanel> But then a new problem. If you open

How to put Expander ToggleButton on right

不羁的心 提交于 2019-12-18 15:53:10
问题 By default the expander has a left aligned toggle button but in my WPF app i want toggle button on the right side of the header without the help of Expression Blend. just plain XAML and/or C#. My expander contains a vertically oriented stackpanel which has labels as its child. I went for its part but here it says "The Expander control does not have any named parts". I found an example here. But it overrides the default Expander Style. I think the attached image should convey what i want. How

How can I make a WPF Expander Stretch?

送分小仙女□ 提交于 2019-12-18 11:41:34
问题 The Expander control in WPF does not stretch to fill all the available space. Is there any solutions in XAML for this? 回答1: All you need to do is this: <Expander> <Expander.Header> <TextBlock Text="I am header text..." Background="Blue" Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Expander}}, Path=ActualWidth}" /> </Expander.Header> <TextBlock Background="Red"> I am some content... </TextBlock> </Expander> http://joshsmithonwpf.wordpress.com/2007/02

Expander button on the right side: how to do it?

末鹿安然 提交于 2019-12-18 04:07:09
问题 i want to position the Expander button on the right side of the label. How to do this? 回答1: You can also set the FlowDirection to RightToLeft , but that may cause other problems. For example it also changes the flow direction for the content of the expander so you may need to set it back. <Expander FlowDirection="RightToLeft"> <StackPanel FlowDirection="LeftToRight"> </StackPanel> </Expander> 回答2: You must restyle the control's template. Here's an example: http://patconroy.wordpress.com/2008

Animate Expander in WPF

自古美人都是妖i 提交于 2019-12-17 19:27:35
问题 How to animate the expanded and collapsed actions of a Wpf expander control? 回答1: I've found this article on Code Project : Read Here The author creates his own SimpleExpander Template, then adds a stretch out animation to it. He even added a nifty rotating arrow to it. 回答2: I created a style based on msdn Style and the point in this answer: <Window x:Class="Test.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml