How to toggle a WPF Grid column visibility

Posted by serialhobbyist on Stack Overflow See other posts from Stack Overflow or by serialhobbyist
Published on 2009-08-02T07:17:21Z Indexed on 2010/03/30 16:13 UTC
Read the original article Hit count: 568

Filed under:
|
|
|
|

I'm having some trouble getting this to work in a WPF app I'm working on. Basically, what I'm after is something like the Task pane in an MMC:

  • The app has three columns in the main part of the display. I need a column on the right side which is resizable. I presume this means using a Grid with a GridSplitter but anything that works will do.
  • I want to be able to save the width of the right-side column when the app is closed and load it when the app is opened but this should be an initial size: the user should be able to resize it.
  • When I resize the window, I want the left- and right-side columns to stay the same size and the middle column to resize with the window width.
  • The left- and right-side columns need to have a minimum width. When I resize the right-side column I want the centre column to get smaller but not the left-side column.
  • I also want to be able to toggle the visibility of the right-side column with a toggle button which is outside the column and when it returns to visibility I want it to be the same width it was before.

I'm trying to do as much as possible in XAML and with binding.

And can I have it topped with cream, ice cream and chocolate chips, please? :-)

© Stack Overflow or respective owner

Related posts about wpf

Related posts about binding