Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6604859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:12:47+00:00 2026-05-25T19:12:47+00:00

Suppose you want to allow a user to re-size a WPF/SL Grid containing two

  • 0

Suppose you want to allow a user to re-size a WPF/SL Grid containing two columns. But you also want to allow the user to hide one column (a “panel”) or the other column. When both columns (panels) are shown, the GridSplitter should be also be shown; otherwise not. You also want to use MVVM-style bindings without code-behind. And maybe you want to persist the settings between sessions. You have these properties in your view-model:

bool IsPanelOneVisible

bool IsPanelTwoVisible

GridLength SplitPosition

So how can I wire this up using only bindings?

Note that a grid column’s width (set either via binding or to Auto) gets overridden when the user drags the GridSplitter.

None of the posts that I’ve perused (which also include a couple of SplitContainer implementations) address this scenario head on. One could wire this up using code-behind (in response to events) or additional properties on the view-model. But I was hoping for a more elegant solution.

Any ideas? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:12:48+00:00Added an answer on May 25, 2026 at 7:12 pm

    We hit the same problem and the binding solutions were so messy we would up creating a user control to do all the above (splitter and toggle of panes on/off).

    The problem is that the 1st column size changes from pixel sized (resizable by the splitter) to autosize and back again. The visibility of the splitter may also change depending on how you want it to function.

    Once you create a user control to do the lot you will stop worrying about MVVM on the inside (code-behind is not evil for user controls, only at an application level) and only worry about exposing MVVM friendly properties like IsPanelOneVisible etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose you have a lightbox, and you want to allow the user to middle-click,
Suppose you want to make an async request in JavaScript, but you want to
For an API that I am working on, I want to allow the user
Suppose I want to allow to select our entity (from a dropdown, etc) on
Suppose I allow user to write his own variable calculation macro using a common
Suppose I have the classes/models Projects (has many lists) Lists I want to allow
I'm using jQuery UI sortable to allow the user to shuffle the list, but
Suppose I want to define an enum pointing to an array of objects. Can
Suppose I want to implement a curses/console like program in HTML/CSS/Javascript. Examples might be
Suppose I want to open a file in an existing Emacs session using su

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.