wpf - How to make expander resize the grid? -


I have an extension like this, the border shown here is a grid around it:

 < Code> ----------------------------------- | | | ^ Expander | | --------------------------------- |  

How can I change the size of this grid when I expand this extension?

The result is like this:

  ---- ------------------------ ------- | | | V extender | | | | | | Expander material. | | | | | --------------------------------- |  

Please do not care about window size or external grid size. I just want to resize this one.

Update:

When the user closes the explorer, then I hope the grid will return to 1 point.

XAML slice:

  & lt; Grid margin = "143,92,143,148" background = "#ff646464" width = "472" height = "217" & gt; & Lt; Border Borderbrush = "# FF 5983 BF" BorderTechnachines = "1" /> & Lt; Expander x: Name = "AdvancedExpander" header = "advanced" horizontal alignment = "left" margin = "10,196,0, -147" width = "452" height = "168" workspaceElement = "top" foreground = "# FFC 7 C7C7 "& gt; & Lt; Grid Background = "# FFE5E5E5" /> & Lt; / Expander & gt; & Lt; / Grid & gt;  

Some buttons were removed, I do not think we need them.

You can use triggers to change "height"

 < Code> & gt; Style target type = "line definition" x: key = "expanded" & gt; & Lt; Style.Triggers & gt; & Lt; Data Trigger Binding = "{Binding is Expanded}" value = "true" & gt; & Lt; Setter property = "height" value = "400" /> & Lt; / DataTrigger & gt; & Lt; /Style.Triggers> & Lt; / Style & gt; & Lt; Grid & gt; & Lt; Grid.RowDefinitions & gt; & Lt; RowDefinition Height = "Auto" style = "{static resource extended road}" /> & Lt; /Grid.RowDefinitions> & Lt; / Grid & gt; & Lt; Expander MaxHeight = "400" name = "Expander" IsExpanded = "{IsIxpanded Binding}" & gt; ... & lt; / Expander & gt;  

ViewModel.cs

Public Butle IEPended {get; Set; }

Comments