This question is locked. New answers and comments are not allowed.
Hi -
We need a little more control than IsRestricted - we want to define the limiting area.
i.e. we have a tool area on the left hand side and a 'work' area for windows on the right hand.
We do not want to cover the tool area with windows. Basically we want to do the following:
1. Define a left limit in pixels
2. Moving should be restricted once window.Left reaches the limit.
3. Maximize window should not expand over the limit.
Alternatively,defining some sort of container (Grid?) to confine the windows would work as well.
Any help? Thanks!
We need a little more control than IsRestricted - we want to define the limiting area.
i.e. we have a tool area on the left hand side and a 'work' area for windows on the right hand.
We do not want to cover the tool area with windows. Basically we want to do the following:
1. Define a left limit in pixels
2. Moving should be restricted once window.Left reaches the limit.
3. Maximize window should not expand over the limit.
Alternatively,defining some sort of container (Grid?) to confine the windows would work as well.
Any help? Thanks!
6 Answers, 1 is accepted
0
Accepted
Hi Enal,
There is also a way to make more precise way to constraint the dragging and resizing of the RadWindow control, but is more complex to use.
Hope this helps. Best wishes,
Miroslav Nedyalkov
the Telerik team
What you need is not supported by the RadWindow control - it supports just a property of type Thickness which defines a rectangular region (which in your case could be (left, 0, 0, 0) ) and doesn't affect the maximized state. Though a work-around exist for this limitation. Here is an example:
private
void
OnOpenWindowClicked(
object
sender, RoutedEventArgs e)
{
var window =
new
RadWindow { Content =
"Some content"
, RestrictedAreaMargin =
new
Thickness(50), IsRestricted =
true
};
new
WindowRestrictedMaximizedStateBehavior(window);
window.Show();
}
private
class
WindowRestrictedMaximizedStateBehavior
{
private
RadWindow window;
public
WindowRestrictedMaximizedStateBehavior(RadWindow window)
{
this
.window = window;
window.WindowStateChanged +=
this
.window_WindowStateChanged;
}
private
void
window_WindowStateChanged(
object
sender, EventArgs e)
{
var window = sender
as
RadWindow;
if
(window.WindowState == WindowState.Maximized && window.IsRestricted)
{
window.Dispatcher.BeginInvoke(UpdateWindowSize);
var root = Application.Current.RootVisual
as
FrameworkElement;
root.SizeChanged +=
this
.root_SizeChanged;
}
else
{
var root = Application.Current.RootVisual
as
FrameworkElement;
root.SizeChanged -=
this
.root_SizeChanged;
}
}
private
void
root_SizeChanged(
object
sender, SizeChangedEventArgs e)
{
this
.UpdateWindowSize();
}
private
void
UpdateWindowSize()
{
var root = Application.Current.RootVisual
as
FrameworkElement;
var presenter = window.ParentOfType<WindowPresenterBase>();
presenter.Left = window.RestrictedAreaMargin.Left;
presenter.Top = window.RestrictedAreaMargin.Top;
presenter.Width = root.ActualWidth - window.RestrictedAreaMargin.Left - window.RestrictedAreaMargin.Right;
presenter.Height = root.ActualHeight - window.RestrictedAreaMargin.Top - window.RestrictedAreaMargin.Bottom;
}
}
There is also a way to make more precise way to constraint the dragging and resizing of the RadWindow control, but is more complex to use.
Hope this helps. Best wishes,
Miroslav Nedyalkov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Enal
Top achievements
Rank 1
answered on 10 Oct 2011, 01:35 PM
Thanks, this approach works well for our purpose.
0
Brian Lam
Top achievements
Rank 1
answered on 13 Dec 2011, 11:53 PM
Is there a reason that RadWindow no longer uses the RestrictedAreaMargin when it's maximized? It used to respect those values as of the Q1 2011 release, but it doesn't do that anymore in Q3 2011. Is this a feature that's going to be added back in?
0
Hello Brian,
This functionality has been changed after the refactoring of the RadWindow. Now, the maximizing of the Window doesn't respect the RestrictedAreaMargin property. We did this change in order to keep the behaviour consistent in WPF and Silverlight. However, a PITS item has been created for returning this behaviour for Silverlight. You can view it here. You can vote for it, track its status and if it receives enough votes we will consider implementing it.
Hope this information helps.
Greetings,
Konstantina
the Telerik team
This functionality has been changed after the refactoring of the RadWindow. Now, the maximizing of the Window doesn't respect the RestrictedAreaMargin property. We did this change in order to keep the behaviour consistent in WPF and Silverlight. However, a PITS item has been created for returning this behaviour for Silverlight. You can view it here. You can vote for it, track its status and if it receives enough votes we will consider implementing it.
Hope this information helps.
Greetings,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Daní
Top achievements
Rank 1
answered on 26 Jan 2012, 03:58 PM
Hi,
Miroslav wrote "There is also a way to make more precise way to constraint the dragging and resizing of the RadWindow control, but is more complex to use." Please, can I have a link or explanation about this more precise way.
I'd like to implement an MDI style application using RadWindow control. Please, Is there any guide or like about this topic?
In addition, I think it would be a good idea that Telerik could offers a built-in MDI container implementation.
Thanks
Miroslav wrote "There is also a way to make more precise way to constraint the dragging and resizing of the RadWindow control, but is more complex to use." Please, can I have a link or explanation about this more precise way.
I'd like to implement an MDI style application using RadWindow control. Please, Is there any guide or like about this topic?
In addition, I think it would be a good idea that Telerik could offers a built-in MDI container implementation.
Thanks
0
Hi DanĂ,
The more complex way that Miroslav is refering to is not working entirely correct. However, this is what you have to do:
1) Hook to the Loaded and SizeChanged events of the page:
2) In each of them call the following method:
It calculates the size of the page (the Silverlight plug-in) and sets an offset of the RadWindow according to it.
However, there are some issues, for example when maximizing and restricting the window after that, so please keep in mind that you might come across more.
Hope this helps.
Kind regards,
Konstantina
the Telerik team
The more complex way that Miroslav is refering to is not working entirely correct. However, this is what you have to do:
1) Hook to the Loaded and SizeChanged events of the page:
this
.Loaded +=
this
.Example_Loaded;
((FrameworkElement)Application.Current.RootVisual).SizeChanged +=
this
.Example_SizeChanged;
2) In each of them call the following method:
public
void
SetRestrictedAreaMarginToRadWindow()
{
GeneralTransform generalTransform1 =
this
.restrictedAreaRectangle.TransformToVisual(Application.Current.RootVisual);
Point topLeftOffset = generalTransform1.Transform(
new
Point(0, 0));
Point bottomRightOffset = generalTransform1.Transform(
new
Point(
this
.restrictedAreaRectangle.RenderSize.Width,
this
.restrictedAreaRectangle.RenderSize.Height));
double
right = ((FrameworkElement)Application.Current.RootVisual).ActualWidth - bottomRightOffset.X;
double
bottom = ((FrameworkElement)Application.Current.RootVisual).ActualHeight - bottomRightOffset.Y;
window.RestrictedAreaMargin =
new
Thickness(topLeftOffset.X, topLeftOffset.Y, right, bottom);
}
It calculates the size of the page (the Silverlight plug-in) and sets an offset of the RadWindow according to it.
However, there are some issues, for example when maximizing and restricting the window after that, so please keep in mind that you might come across more.
Hope this helps.
Kind regards,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>