using DevExpress.Xpf.Docking;
using DevExpress.Xpf.Layout.Core;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace Saatody.Module.Startup
{
public partial class SaatodyApplication : Window
{
private StartPage StartPage = new StartPage();
public SaatodyApplication()
{
InitializeComponent();
Event();
}
private LayoutGroup Root = new LayoutGroup();
private LayoutGroup LG = new LayoutGroup();
private DocumentGroup DG = new DocumentGroup();
private TabbedGroup TG = new TabbedGroup();
private LayoutPanel LP = new LayoutPanel();
private DocumentPanel DP = new DocumentPanel();
private DocumentPanel TDP = new DocumentPanel();
private LayoutPanel TP = new LayoutPanel();
private void Event()
{
Dock.ShowingDockHints += (sender, e) => {
if ((e.DraggingSource).GetType() == typeof(DocumentPanel))
{
if (((e.DraggingTarget).GetType() != typeof(DocumentGroup)) && ((e.DraggingTarget).GetType() != typeof(DocumentPanel)))
{
System.Console.WriteLine("1 Type: " + (e.DraggingTarget).GetType());
e.HideAll();
}
else if (((e.DraggingTarget).GetType() == typeof(DocumentGroup)) || ((e.DraggingTarget).GetType() == typeof(DocumentPanel)))
{
System.Console.WriteLine("2 Type: " + (e.DraggingTarget).GetType());
e.Hide(DockHint.AutoHideBottom);
e.Hide(DockHint.AutoHideLeft);
e.Hide(DockHint.AutoHideRight);
e.Hide(DockHint.AutoHideTop);
//e.Hide(DockHint.Center);
//e.Hide(DockHint.CenterBottom);
//e.Hide(DockHint.CenterLeft);
//e.Hide(DockHint.CenterRight);
//e.Hide(DockHint.CenterTop);
e.Hide(DockHint.SideBottom);
e.Hide(DockHint.SideLeft);
e.Hide(DockHint.SideRight);
e.Hide(DockHint.SideTop);
e.Hide(DockHint.TabBottom);
e.Hide(DockHint.TabHeader);
e.Hide(DockHint.TabLeft);
e.Hide(DockHint.TabRight);
e.Hide(DockHint.TabTop);
}
}
};
this.Loaded += (sender, e) => {
Dock.DockController.Dock(Root);
Dock.DockController.Dock(LG);
Dock.DockController.Dock(DG);
Dock.DockController.Dock(TG);
LP = new LayoutPanel();
LP.Caption = "Layout";
Dock.DockController.Dock(LP, LG, DockType.Fill);
DP = new DocumentPanel();
DP.Caption = "Document";
Dock.DockController.Dock(DP, DG, DockType.Fill);
TDP = DP;
TP = new LayoutPanel();
TP.Caption = "Tabbed";
Dock.DockController.Dock(TP, TG, DockType.Fill);
LG.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0));
DG.Background = new SolidColorBrush(Color.FromRgb(0, 255, 0));
TG.Background = new SolidColorBrush(Color.FromRgb(0, 0, 255));
LG.DestroyOnClosingChildren = false;
DG.DestroyOnClosingChildren = false;
TG.DestroyOnClosingChildren = false;
};
OpenNewProject.ItemClick += (sender, e) => {
LP = new LayoutPanel();
LP.Caption = "Layout";
Dock.DockController.Dock(LP, LG, DockType.Fill);
};
OpenOpenProject.ItemClick += (sender, e) => {
DP = new DocumentPanel();
DP.Caption = "Document";
if (Dock.ActiveDockItem != null)
{
if (Dock.ActiveDockItem.GetType() == typeof(DocumentPanel)){
if (Dock.ActiveDockItem.IsFloating == false)
{
Dock.DockController.Dock(DP, Dock.ActiveDockItem, DockType.Fill);
TDP = DP;
}
else if (Dock.ActiveDockItem.IsFloating == true)
{
if (TDP.IsClosed == false)
{
if (TDP.IsFloating == false)
{
Dock.DockController.Dock(DP, TDP, DockType.Fill);
TDP = DP;
}
else if (TDP.IsFloating == true)
{
// Any Group To Use For Fill
Dock.DockController.Dock(DP, DG, DockType.Fill);
TDP = DP;
}
}
else
{
// Any Group To Use For Fill
Dock.DockController.Dock(DP, DG, DockType.Fill);
TDP = DP;
}
}
}
else if(Dock.ActiveDockItem.GetType() != typeof(DocumentPanel))
{
if (TDP.IsClosed == false)
{
if (TDP.IsFloating == false)
{
Dock.DockController.Dock(DP, TDP, DockType.Fill);
TDP = DP;
}
else if (TDP.IsFloating == true)
{
// Any Group To Use For Fill
Dock.DockController.Dock(DP, DG, DockType.Fill);
TDP = DP;
}
}
else
{
// Any Group To Use For Fill
Dock.DockController.Dock(DP, DG, DockType.Fill);
TDP = DP;
}
}
}
else
{
if (TDP.IsClosed == false)
{
Dock.DockController.Dock(DP, TDP, DockType.Fill);
TDP = DP;
}
else
{
// Any Group To Use For Fill
Dock.DockController.Dock(DP, DG, DockType.Fill);
TDP = DP;
}
}
};
OpenStartPage.ItemClick += (sender, e) => {
TP = new LayoutPanel();
TP.Caption = "Tabbed";
Dock.DockController.Dock(TP, TG, DockType.Fill);
};
}
}
}
Comments
Post a Comment