This is a migrated thread and some comments may be shown as answers.

Can i create a RadWindow that can be resizable but without Maximize and Minimize button?

15 Answers 325 Views
Window
This is a migrated thread and some comments may be shown as answers.
Michael Chong
Top achievements
Rank 1
Michael Chong asked on 02 Sep 2009, 09:14 AM
As what the title says.

Hope for any help and information.

Thank you.

15 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 02 Sep 2009, 11:35 AM
Hello Michael,

Yes, you can do this. What you need to do is to change the ControlTemplate of the RadWindow control and to remove the buttons from the original one.

If you have further questions, don't hesitate to ask.

Regards,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Michael Chong
Top achievements
Rank 1
answered on 03 Sep 2009, 01:17 AM
Can I have some sample code?

Thank you.
0
Miroslav Nedyalkov
Telerik team
answered on 03 Sep 2009, 08:44 AM
Hi Michael,

The attached project demonstrates how to do this.

Regards,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Rodrigo Mamede
Top achievements
Rank 1
answered on 09 Mar 2010, 09:59 PM
work fine when i have just one window.

but, i realized that just one window can be opened. If i try to open a "Custom window" and inside this try to open a new "Custom window" an error occur.

any ideias?
0
Miroslav Nedyalkov
Telerik team
answered on 11 Mar 2010, 03:51 PM
Hi Rodrigo,

 Could you please send us a sample project that reproduces the issue - this will help us find out what causes the problem?

Sincerely yours,
Miroslav Nedyalkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Rodrigo Mamede
Top achievements
Rank 1
answered on 11 Mar 2010, 08:13 PM
Hi,

let me try ti explane.

i created a user control, with a RADWINDOW. On the style i remove the buttons Minimize and Maximize.
<UserControl 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" 
    xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
    x:Class="MyWayDesigner.UIWebSilverlight.JanelaCustomResizableView" 
    > 
 
    <UserControl.Resources> 
        <SolidColorBrush x:Key="BorderShadowColor1" Color="#0C000000"/> 
        <SolidColorBrush x:Key="BorderShadowColor2" Color="#19000000"/> 
        <SolidColorBrush x:Key="BorderShadowColor3" Color="#33000000"/> 
        <SolidColorBrush x:Key="BorderShadowColor4" Color="#4C000000"/> 
        <SolidColorBrush x:Key="RadWindow_OuterOuterBorder" Color="#CA000000"/> 
        <LinearGradientBrush x:Key="RadWindow_OuterBorder" EndPoint="0.933220924036204,0.903735795235198" StartPoint="0.0687608619440813,0.315483972696259"
            <GradientStop Color="#FFDEDEDE" Offset="1"/> 
            <GradientStop Color="#FFFFFFFF" Offset="0.35294289873343759"/> 
        </LinearGradientBrush> 
        . 
        . 
        . 
        . 
            <Setter Property="HorizontalAlignment" Value="Left"/> 
            <Setter Property="VerticalAlignment" Value="Top"/> 
            <Setter Property="WindowState" Value="Normal"/> 
            <Setter Property="WindowStartupLocation" Value="Manual"/> 
            <Setter Property="Header" Value="RadWindow"/> 
            <Setter Property="Margin" Value="0"/> 
            <Setter Property="TabNavigation" Value="Cycle"/> 
        </Style> 
    </UserControl.Resources> 
 
    <Grid x:Name="LayoutRoot"
        <telerikNavigation:RadWindow x:Name="window" VerticalAlignment="Stretch" Content="RadWindow" d:LayoutOverrides="Height" HorizontalAlignment="Stretch" Style="{StaticResource RadWindowStyle}"/> 
    </Grid> 
</UserControl> 
 

To open this custom window i´m using:

           JanelaCustomResizableView janelaAbrir = new JanelaCustomResizableView(); 
            janelaAbrir.window.ModalBackground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(150, 0, 0, 0)); 
            janelaAbrir.window.ResizeMode = ResizeMode.CanResize; 
            janelaAbrir.window.WindowStartupLocation = WindowStartupLocation.CenterOwner; 
            janelaAbrir.window.Header = "Abrir Projeto"
            janelaAbrir.window.Content = new AbrirProjetoDePortal(janelaAbrir.window); 
            janelaAbrir.window.ShowDialog(); 

this works fine.

But when i need open a new window without closing the first one the second window does not open..


0
Hristo
Telerik team
answered on 18 Mar 2010, 09:26 AM
Hi Rodrigo Mamede,

I'm sorry for the late response.
Could you share we us your project so that we can get better understanding on your scenario? (in order to attach files you have to open a support ticket).
How do you open janelaAbrir.window for the second time?

Kind regards,
Hristo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Colin
Top achievements
Rank 1
answered on 13 Oct 2010, 05:51 AM
Expecting people to modify a control template for what should be basic, supplied properties is a brain - dead solution, sorry :(
The ResizeMode property should be changed to add the ability to hide the minimize, hide the maximize and retain resizing if desired.

Your minimize function is also worthless if the user has set a minimum size and ends up removing the content of the window, rather than rolling it up into the header as it does when minimum size is not selected.
0
Miroslav Nedyalkov
Telerik team
answered on 18 Oct 2010, 01:20 PM
Hello Colin,

 We are currently working on the case with hiding the buttons independently of the WindowResizeMode property. This will be possible by handling and stopping the commands of the buttons. This feature will be included in the Q3 release.

Setting MinWidth and MinHeight will prevent the whole control to become smaller than these sizes - this is how the Silverlight/WPF layout works and we cannot change that. What you can do is to hook-up to the WindowStateChanged event and to reset the MinWdith/Height if minimized and to restore it if not.

Hope this helps!

Sincerely yours,
Miroslav Nedyalkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
João
Top achievements
Rank 2
answered on 17 Nov 2010, 05:28 PM
Hi,

I haven't tried Q3 yet. Has this feature been implemented?

I'm trying to create a RadWindow that can be resized, closed and maximized but not minimized. Is this possible to do without having to change the control template? Honestly having to change the control template to tweak some basic window functionallity seems to me like a hack.

Best regards,
Manuel Felício.
0
Miroslav Nedyalkov
Telerik team
answered on 22 Nov 2010, 04:26 PM
Hello Mario,

 What you need to do to stop minimizing functionality is to handle and stop the WindowCommands.Minimize command. Here is an example that demonstrates how to hide the Minimize button:

var window = new RadWindow();
CommandManager.AddPreviewCanExecuteHandler(window, (s, e) =>
{
    if (e.Command == WindowCommands.Minimize)
    {
        e.Handled = true;
        e.CanExecute = false;
    }
});
window.Show();

All the best,
Miroslav Nedyalkov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Denis Vuyka
Top achievements
Rank 1
answered on 27 May 2011, 12:28 PM
As for "CommandManager.AddPreviewCanExecuteHandler"...
This seems to be a workaround rather than a solution as for me, sorry. I would discourage people using such approach for production code even if someone proves this code does not provide memory leaks. 
Can we just have a dedicated API for that? Something like "ShowMinimizeButton" property, so that everyones configures the behavior, and your control has all the implementation the way you want it.
Thanks in advance,
Denis
0
Miroslav Nedyalkov
Telerik team
answered on 30 May 2011, 08:31 AM
Hello Denis,

 Thank you for sharing your opinion. Actually this code shouldn't produce any memory leaks if the handler is a static method instead of anonymous method. The example is using an anonymous method just for shortcut.

The reason why we didn't add property for the minimize button is that we don't want to add such property for every single visual element of the RadWindow. The correct way to remove visual parts is to change the ControlTemplate of the control and as you correctly noticed handling the PreviewExecute is a shortcut for this, not for a missing feature.

Best wishes,
Miroslav Nedyalkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
kevin
Top achievements
Rank 1
answered on 17 Aug 2011, 10:13 PM
Is there no easier way to choose which button options you want to be exposed on a per-window basis? Having a completely different template style for each type of window makes little sense. 

Thanks!
Kevin
0
Miroslav Nedyalkov
Telerik team
answered on 19 Aug 2011, 07:53 AM
Hi Kevin,

 You could use either the approach I suggested in this thread (by handling the button commands) or to directly remove the buttons in the style. Hope this helps.

Regards,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
Window
Asked by
Michael Chong
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Michael Chong
Top achievements
Rank 1
Rodrigo Mamede
Top achievements
Rank 1
Hristo
Telerik team
Colin
Top achievements
Rank 1
João
Top achievements
Rank 2
Denis Vuyka
Top achievements
Rank 1
kevin
Top achievements
Rank 1
Share this question
or