Both WindowContainer
and ChildWindow
of the Extended WPF Toolkit have Left
and Top
properties available in XAML but neither of those two properties are available in code behind.
How can we change the position of WindowContainer
or ChildWindow
from code if these properties are not exposed?
private void VerifyWindowSize(Xceed.Wpf.Toolkit.Primitives.WindowContainer wc)
{
if (wc == null) return;
if (wc.Width > screen.WorkingArea.Width)
{
wc.Width = screen.WorkingArea.Width;
//wc.Left = screen.WorkingArea.Left; // Cannot resolve symbol Left
}
if (!(wc.Height > screen.WorkingArea.Height)) return;
wc.Height = screen.WorkingArea.Height;
//wc.Top = screen.WorkingArea.Top;
}
WindowContainer is a Canvas, therefore its own Left
and Top
dependency properties are attached. They are not meant for the WindowContainer
itself, but for its children.
If you want to set - for example - the Left
attached property for a child of a Canvas
, you can use the related method SetLeft.
On the other side the ChildWindow control has its own Left and Top properties, they are not attached and you can use it in your code without any problem.
I hope it can help you.