File Name SampleProject My xaml file Mainwindow.xaml----------
<Window x:Class="SampleProject.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking" Closing="Window_Closing"
Title="MainWindow" Height="800" Width="800" WindowState="Maximized">
<Grid>
<dxdo:DockLayoutManager x:Name="docklayoutmanager1" dxdo:RestoreLayoutOptions.RemoveOldPanels="False" dxdo:RestoreLayoutOptions.RemoveOldLayoutControlItems="False" Margin="0,50,0,0">
</dxdo:DockLayoutManager>
<Button Width="100" VerticalAlignment="Top" HorizontalAlignment="Center" Height="30" x:Name="ClickMe" Content="Click Me" Click="ClickMe_Click" Margin="323,10,369,729" />
</Grid>
</Window>
` My xaml.cs file MainWindow.xaml.cs-------------------
using DevExpress.Xpf.Docking;
using DevExpress.Xpf.Layout.Core;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SampleProject
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
if(File.Exists("test.xml"))
{
docklayoutmanager1.RestoreLayoutFromXml("test.xml");
}
}
private void ClickMe_Click(object sender, RoutedEventArgs e)
{
var panel = docklayoutmanager1.DockController.AddPanel(DockType.None);
panel.Caption = "Test Panel";
panel.Name = "myPanel";
panel.Content = "I want to serialize this code using guid Please provide example for creating such binding.";
FloatGroup floatgroup = new FloatGroup();
floatgroup.Name = "myFloatGroup";
floatgroup.FloatSize = new Size(500,500);
floatgroup.FloatLocation = new Point(300, 300);
floatgroup.Add(panel);
docklayoutmanager1.FloatGroups.Add(floatgroup);
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
string xmlFilePath = System.AppDomain.CurrentDomain.BaseDirectory + "test.xml";
if (File.Exists("test.xml"))
{
docklayoutmanager1.SaveLayoutToXml("test.xml");
}
else
{
using (File.Create("test.xml")) { }
docklayoutmanager1.SaveLayoutToXml("test.xml");
}
}
}
}
I have a document layout manager programmatically getting panels and controls which is having panels and controls in them.
While saving, I am achieving this with SaveLayoutToXml()
for my panels and Serializing controls using bformatter.Serialize();
.
since i have lot of panels and unique controls in them. I want to get the same controls back in same panels as it was before saving and serializing. Please provide me with a code to identify with a unique id for both panels and controls.
And do I have any integer id to which I can assign GUID as BindableName does not work with it.
Thanks Desh