Specifying a different ‘RowDefinition’ height in different VisualStates ...

Answered Specifying a different ‘RowDefinition’ height in different VisualStates ...

  • Thursday, September 20, 2012 1:19 PM
     
     

    Greetings All,

    I have a ‘Grid’, which I’ve split up into 3 rows ( … so I have two ‘RowDefinitions’ slicing up the grid).  I’m using a ‘gridSplitter’ so the user can manually extend the contents of the 'middle-row' (it’s a re-sizable help window), works great...

    Q:  How can I specify the height of one of the grid's ‘RowDefinition’ in my visualstates - so I can jump between a full-screen-state and a minimized-state version (but still allow it to be manually dragged to a halfway position by the user )?

    Many Thanks in advance (Apologies for any ambiguity :)

    -RJ-

    Blend4, WPF, C#





    • Edited by dt01rrj Thursday, September 20, 2012 1:19 PM
    • Edited by dt01rrj Thursday, September 20, 2012 2:14 PM
    • Edited by dt01rrj Thursday, September 20, 2012 2:43 PM
    •  

All Replies

  • Thursday, September 20, 2012 1:35 PM
     
     

    ... or how would I change it via C# as a last/untidy resort ... MyTopRow.RowDefinitions[0].Height = new GridLength(49.5);   .... ??? 

    :S ... Cheers,

    -RJ-

  • Thursday, September 20, 2012 3:31 PM
     
     Answered

    I don't know of a way to do it out-of-the-box in VisualStates. There are a couple links here that look promising:

    http://stackoverflow.com/questions/197855/in-wpf-has-anybody-animated-a-grid

    http://marlongrech.wordpress.com/2007/08/20/gridlength-animation/

    I'd try looking through those to see if they can be modified to suit what you're trying to accomplish. If you have any questions on particulars, feel free to ask.

    • Marked As Answer by dt01rrj Friday, September 21, 2012 9:00 AM
    •  
  • Friday, September 21, 2012 9:00 AM
     
     Answered

    Greetings Brian,

    Many Thanks for your reply :) ... 99.99% of it was totally over my head :S ... but it did help guide me towards an answer :D

    There's no way of producing two different RowDefinition states in the VisualStateManager ... so I've had to incorporate it as a C# snippet ... if it helps I've included the solution below ...

    MyPulloutHelpGrid.RowDefinitions[0].Height = new GridLength(0, GridUnitType.Star);
    MyPulloutHelpGrid.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Star);

    ['Solution' found at ... http://social.msdn.microsoft.com/Forums/en/wpf/thread/8cde2f7d-9587-4079-bf41-ff107437f3e2  ]

    (I'm not sure exactly how it works [it was a bit of trial and error] ... but I think it causes the top row's height to become zero, and the middle row (containing the top edge of my 'help window' and draggable gridSplitter) to fill the full height of the grid [the .Star is just a ratio of how much space the rows take up])


    Many Thanks,

    Regards,

    -RJ-


    • Marked As Answer by dt01rrj Friday, September 21, 2012 9:00 AM
    • Edited by dt01rrj Friday, September 21, 2012 9:02 AM
    •  
  • Tuesday, October 02, 2012 4:49 PM
     
     

    Hello, RJ et al -

    I want to do pretty much the same thing, but I am a nonprogrammer who primarily relies on visual states or recording to storyboards to create my interactivity. The C# commands look promising, but can anyone explain to someone who is not a C#/VB developer where they would go? Or if there is a way of accomplishing the same thing via the Blend UI?  (I have Blend 4.)

    Thanks,
    B