Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expander with GridSplitter

I've a grid splitter before to the expander(which exists in the right side of a wpf window) and when i was running the app i need to use grid splitter to see more data from expander after its expanded, but the problem is when i was drag splitter i'm getting full view of my expander irrespective of original width but after click on expander to collapse it won't go to its original position by maintaining the splitter dragged width. So any one help me how can i send back expander to its original position.

Thanks, @nagaraju.

like image 595
nag Avatar asked Feb 17 '12 07:02

nag


2 Answers

Once you have used the splitter the grid column widths will no longer be 'auto'.
One solution is to respond to the collapsed event of the expander and reset the width of the first column to auto using column.Width=GridLength.Auto;

like image 156
Phil Avatar answered Nov 18 '22 15:11

Phil


As you are resizing the contents of the Expander it may make more sense to place the GridSplitter inside the Expander, and on the outside you just have a normal Grid which makes the cell where the Expander is size to content.

like image 41
H.B. Avatar answered Nov 18 '22 16:11

H.B.