0

I am using Gridsplitter control to give the flexibility of resizing the heights of a grid and a tab in a MVVM driven WPF application. It is working with out any problem, but after I resize the height of any of the controls I navigate to some other screen and comes back to this screen I am losing the changes. The controls are again reset to their default heights.

Can somebody suggest me an efficient way of restoring the changes when we come back ?

This is the code I am using.

 <igDP:XamDataGrid Grid.Row="1" Grid.Column="0"  DockPanel.Dock="Top" />
 <GridSplitter Grid.Row="2" HorizontalAlignment="Stretch" 
               VerticalAlignment="Center" Height="2"/>
 <TabControl Grid.Row="3" Grid.Column="0" DockPanel.Dock="Top">

Thanks in advance.

rednerus
  • 401
  • 2
  • 9
  • 21
  • Post your code you tried so far... – Sankarann Jan 27 '14 at 15:54
  • This is all UI. Simply watch in your codebehind for your view unloading, save the locations of everything, then reload them on load. –  Jan 27 '14 at 18:29
  • That's probably because you're using a Page that gets unloaded when not in view, then reloaded entirely when it comes back in view. Page is probably meant to save memory usage, therefore, you need some way to store page commits/edits and restore them when loaded again. – Karl Stephen Jan 19 '22 at 08:52

1 Answers1

0

First it would be nice to see actual code you can do that by pasting some code in your question and the use cyrly brackets under the yellow banner when you start typing ;-).

Secondly It seems like you could use binding with your ViewModel i.e. VM.UserSettings.TabHeight. and then in .xaml this is assuming

<Page or Window.DataContext>
<vm:ViewModel />
</Page or Window.DataContext>
<TabControl Height={Binding UserSettings.TabHeight}">

good luck :-)

XAMlMAX
  • 2,268
  • 1
  • 14
  • 23