Monday, 15 July 2013

wpf - Resizing only open expanders -


I have 3 expansions in a window and I want to know that there is a way to do this so that I have an extension 2 And 3 are open but not 1, it will only spread to those 2 It is currently pulling the three together equally, and, when they are closed, the material is closed, but the column remains in the same width as it was open.

What is the best way to stretch them after expanding and after 10-pixtile wide sizes?

You can set triggers to column define < Fixed when setting to width to / code> when extension stops and when extension is open then set to proportionate .

Example:

  & lt; Grid & gt; & Lt; Grid.ColumnDefinitions & gt; & Lt; ColumnDefinition & gt; & Lt; ColumnDefinition.Style & gt; & Lt; Style TargetType = "ColumnDefinition" & gt; & Lt; Setter property = "width" value = "20" /> & Lt; Style.Triggers & gt; & Lt; Data Trigger Binding = "{Binding IE Expanded, ElementName = Explorer 1}" Value = "True" & gt; & Lt; Setter property = "width" value = "20 *" /> & Lt; / DataTrigger & gt; & Lt; /Style.Triggers> & Lt; / Style & gt; & Lt; /ColumnDefinition.Style> & Lt; / ColumnDefinition & gt; & Lt; ColumnDefinition & gt; & Lt; ColumnDefinition.Style & gt; & Lt; Style TargetType = "ColumnDefinition" & gt; & Lt; Setter property = "width" value = "20" /> & Lt; Style.Triggers & gt; & Lt; DataTrigring binding = "{binding ispended, element = explorer 2}" value = "true" & gt; & Lt; Setter property = "width" value = "20 *" /> & Lt; / DataTrigger & gt; & Lt; /Style.Triggers> & Lt; / Style & gt; & Lt; /ColumnDefinition.Style> & Lt; / ColumnDefinition & gt; & Lt; ColumnDefinition & gt; & Lt; ColumnDefinition.Style & gt; & Lt; Style TargetType = "ColumnDefinition" & gt; & Lt; Setter property = "width" value = "20" /> & Lt; Style.Triggers & gt; & Lt; DataTrigring Binding = "{Binding IE Expanded, Element Name = Expender 3}" Value = "True" & gt; & Lt; Setter property = "width" value = "20 *" /> & Lt; / DataTrigger & gt; & Lt; /Style.Triggers> & Lt; / Style & gt; & Lt; /ColumnDefinition.Style> & Lt; / ColumnDefinition & gt; & Lt; /Grid.ColumnDefinitions> & Lt; Expander Name = "Extension 1" Grid. Column = "0" header = "expander 1" /> & Lt; Expander Name = "Extender 2" Grid Column = "1" header = "expander 2" /> & Lt; Expander Name = "Extender 3" Grid Column = "2" header = "expander 3" /> & Lt; / Grid & gt;   

Result:

Enter image details here enter image details here

 Enter image details here  Enter image details here

No comments:

Post a Comment