I'm using Silverlight 4 and Telerik 2011.1.419.1040. Is there any way to set a fixed width and height for a floating RadPane? I found the post referring to SL3, however, the assemblies are different and the resource does not compile.
SL3 Post:
http://www.telerik.com/community/forums/silverlight/docking/disable-the-possibility-to-let-the-user-resize-a-radpane.aspx
7 Answers, 1 is accepted
private
void
radDocking_PaneStateChange(
object
sender, Telerik.Windows.RadRoutedEventArgs e)
{
foreach
(RadPane pane
in
radDocking.Panes)
{
if
(pane !=
null
&& pane.IsFloating)
{
ToolWindow toolWindow = GetToolWindow(pane);
toolWindow.Height = 200;
toolWindow.Width = 200;
}
}
}
private
ToolWindow GetToolWindow(RadPane pane)
{
ToolWindow window = pane.ParentOfType<ToolWindow>();
if
(window ==
null
)
{
window = (((pane.Parent
as
RadPaneGroup).Parent
as
RadSplitContainer).Parent)
as
ToolWindow;
}
return
window;
}
Hope that helps.
A good idea, however not really the solution I’m looking for. If I could disable the ability to resize, that would work. These windows are more like dialogs and cannot dock when they’re in a different state.
Is there any way to prevent the RadPane from resizing at all?
You could set the Max/Min Width and Height of the ToolWindow like this:
toolwindow.MinHeight = 200;
toolwindow.MinWidth = 300;
toolwindow.MaxHeight = 200;
toolwindow.MaxWidth = 300;
That will prevent the resize.
Hope this helps.
Greetings,
Konstantina
the Telerik team
That worked, partially. It prevents the window from resizing but the resize icon (arrows) still shows up when hovering over the edges. Is there any way to prevent the resize icon from displaying?
Code:
ToolWindow parentToolWindow = Telerik.Windows.Controls.UIElementExtensions.ParentOfType<ToolWindow>(radPane);
if
(parentToolWindow !=
null
)
{
parentToolWindow.MinHeight =
parentToolWindow.MaxHeight = FixedHeight;
parentToolWindow.MinWidth =
parentToolWindow.MaxWidth = FixedWidth;
}
I thought of a better way to do this. Since Q2 2011 the ToolWindow and the RadWindow inherit a common class. So, you could set the ResizeMode property of the ToolWindow, instead of setting the Min and Max sizes. In that way the ToolWindow won't be resizable and the arrows will be gone.
Another approach is to inherit the DefaultGeneratedItemsFactory and override the CreateToolWindow property.
Please find attached a sample project which illustrates both approaches.
Best wishes,
Konstantina
the Telerik team
Cody
You can try to set CanClose= false, another property that comes from the common class of ToolWindow and RadWindow.
All the best,
Boyan
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>