Dear Team,
I am using the docking custom property provider to save the state of my layout. When i reload the layout i can able to load the three different radpane in the specified position but data is not loading. please help to check and advise on this issue.
<
Grid
>
<
Grid
Opacity
=
"{Binding MainGridOpacity}"
>
<
telerik:RadDocking
x:Name
=
"radDocking"
HasDocumentHost
=
"False"
>
<
telerik:RadDocking.DocumentHost
>
<
telerik:RadSplitContainer
ScrollViewer.VerticalScrollBarVisibility
=
"Auto"
>
<
telerik:RadSplitContainer
Orientation
=
"Vertical"
telerik:ProportionalStackPanel.RelativeSize
=
"70, 100"
>
<
telerik:RadPaneGroup
>
<
telerik:RadPane
x:Name
=
"radPane1"
Header
=
"Dashboard"
telerik:RadDocking.SerializationTag
=
"radPane1"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
StackPanel
>
<
telerik:RadTabControl
Width
=
"Auto"
VerticalAlignment
=
"Stretch"
x:Name
=
"radDashboardTabControl"
>
</
telerik:RadTabControl
>
</
StackPanel
>
</
Grid
>
</
telerik:RadPane
>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
<
telerik:RadSplitContainer
Orientation
=
"Vertical"
InitialPosition
=
"DockedRight"
telerik:ProportionalStackPanel.RelativeSize
=
"30, 100"
>
<
telerik:RadSplitContainer
Orientation
=
"Horizontal"
>
<
telerik:RadPaneGroup
telerik:ProportionalStackPanel.RelativeSize
=
"50, 50"
>
<
telerik:RadPane
Header
=
"ApplicationInfo"
telerik:RadDocking.SerializationTag
=
"ApplicationInfo"
>
<!--<ScrollViewer VerticalScrollBarVisibility="Auto">-->
<
StackPanel
>
<
TextBlock
Text
=
"{Binding AppNo}"
/>
<
ContentControl
x:Name
=
"appInfoControl"
/>
</
StackPanel
>
<!--</ScrollViewer>-->
</
telerik:RadPane
>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
<
telerik:RadSplitContainer
Orientation
=
"Horizontal"
>
<
telerik:RadPaneGroup
x:Name
=
"radPaneGroup1"
telerik:ProportionalStackPanel.RelativeSize
=
"50, 50"
>
<
telerik:RadPane
x:Name
=
"radPane11"
Header
=
"WorkLoad"
telerik:RadDocking.SerializationTag
=
"radPane11"
>
<
ScrollViewer
Visibility
=
"Visible"
HorizontalScrollBarVisibility
=
"Visible"
>
<
ContentControl
x:Name
=
"workLoadControl"
/>
</
ScrollViewer
>
</
telerik:RadPane
>
</
telerik:RadPaneGroup
>
</
telerik:RadSplitContainer
>
</
telerik:RadSplitContainer
>
</
telerik:RadSplitContainer
>
</
telerik:RadDocking.DocumentHost
>
</
telerik:RadDocking
>
</
Grid
>
<
Grid
>
<
StackPanel
Margin
=
"3"
>
<
telerik:RadButton
Margin
=
"0 2"
Width
=
"200"
Content
=
"Save Layout"
Click
=
"OnSave"
x:Name
=
"buttonSave"
/>
<
telerik:RadButton
Margin
=
"0 2"
Width
=
"200"
Content
=
"Load Layout"
Click
=
"OnLoad"
x:Name
=
"buttonLoad"
/>
</
StackPanel
>
</
Grid
>
</
Grid
>
public
partial
class
DashboardGridView : UserControl
{
System.IO.Stream stream;
public
DashboardGridView()
{
ServiceProvider.RegisterPersistenceProvider<ICustomPropertyProvider>(
typeof
(Telerik.Windows.Controls.RadDocking),
new
DockingCustomPropertyProvider());
}
private
void
OnSave(
object
sender, System.Windows.RoutedEventArgs e)
{
PersistenceManager manager =
new
PersistenceManager();
this
.stream = manager.Save(
this
.radDocking);
this
.EnsureLoadState();
using
(FileStream file =
new
FileStream(@
"C:\temp\file.bin"
, FileMode.Create, System.IO.FileAccess.Write))
{
byte
[] bytes =
new
byte
[stream.Length];
stream.Read(bytes, 0, (
int
)stream.Length);
file.Write(bytes, 0, bytes.Length);
stream.Close();
}
}
private
void
OnLoad(
object
sender, System.Windows.RoutedEventArgs e)
{
using
(stream =
new
MemoryStream())
{
using
(FileStream file =
new
FileStream(@
"C:\temp\file.bin"
, FileMode.Open, FileAccess.Read))
{
byte
[] bytes =
new
byte
[file.Length];
file.Read(bytes, 0, (
int
)file.Length);
stream.Write(bytes, 0, (
int
)file.Length);
}
this
.stream.Position = 0L;
PersistenceManager manager =
new
PersistenceManager();
manager.Load(
this
.radDocking,
this
.stream);
this
.EnsureLoadState();
}
}
private
bool
CanLoad()
{
return
this
.stream !=
null
&&
this
.stream.Length > 0;
}
private
void
EnsureLoadState()
{
this
.buttonLoad.IsEnabled =
this
.CanLoad();
}
}