RibbonWindow - WindowStyle properties

Jun 30, 2010 at 12:22 AM
Edited Jun 30, 2010 at 4:42 PM

We have noticed that with Fluent.dll (version 1.3) that the Ribbon Window does not respond to the WindowStyle settings.  Is this something that can be added to the current control.  We are particularly looking for ToolWindow.  Thanks Kristi

Window Style

The border that is exposed from the non-client area of a window is suitable for most applications. However, there are circumstances where different types of borders are needed, or no borders are needed at all, depending on the type of window.

To control what type of border a window gets, you set its WindowStyle property with one of the following values of the WindowStyle enumeration:

The effect of these window styles are illustrated in the following figure.

Window styles
Nov 1, 2010 at 6:04 PM

KristiL,

I fully agreed, the WindowStyle settings for the RibbonWindow are missing, in 2.0 as well.

@daVinci,

please include the functionality into the RibbonWindow. It is ridiculous, that developers need to duplicate code and styles to have a homogeneous UI layout.  A property IsMinMaxEnabled would do, potentially make the NativeMethods public, that we can get access to the NativeMethods.EnableMenuItem() method.

Thanks,

Vdue

 

 

Nov 1, 2010 at 7:40 PM

Here a quick fix to have at least a ToolWindow, not fully tested but so far it works for me:

How to use:

IsMinMaxEnabled = false;
ResizeMode = ResizeMode.NoResize;

ResizeMode is important for Win7, otherwise you run into trouble if you move your tool window into the upper left corner

 

You need to modify RibbonWindow.cs and RibbonWindow.xaml

RibbonWindow.cs - Include:

/// <summary>
/// Gets or sets whether min max buttons are enabled
/// </summary>
public bool IsMinMaxEnabled
{
	get { return (bool)GetValue(IsMinMaxEnabledProperty); }
	set { SetValue(IsMinMaxEnabledProperty, value); }
}

/// <summary>
/// Gets or sets whether min max buttons are enabled
/// </summary>
public static readonly DependencyProperty IsMinMaxEnabledProperty = DependencyProperty.Register("IsMinMaxEnabled", typeof(bool), typeof(RibbonWindow), new UIPropertyMetadata(true));

RibbonWindow.cs - Modify:

// Handles Maximize command
static void OnMaximizeCommandExecuted(object sender, ExecutedRoutedEventArgs e)
{
	RibbonWindow window = sender as RibbonWindow;
	// changed: Vdue
	if (window != null && window.IsMinMaxEnabled) window.WindowState = WindowState.Maximized;
}

// Handles Minimize command
static void OnMinimizeCommandExecuted(object sender, ExecutedRoutedEventArgs e)
{
	RibbonWindow window = sender as RibbonWindow;
	// changed: Vdue
	if (window != null && window.IsMinMaxEnabled) window.WindowState = WindowState.Minimized;
}

RibbonWindow.xaml - Include:

<ControlTemplate.Triggers>
	...
	<Trigger Property="IsMinMaxEnabled" Value="False">
			<Setter Property="Visibility" TargetName="minimizeButton" Value="Collapsed"/>
			<Setter Property="Visibility" TargetName="maximizeButton" Value="Collapsed"/>
	</Trigger>
<ControlTemplate.Triggers>

 

Coordinator
Nov 2, 2010 at 7:06 AM

You can use System.Windows.Window if you want a regular behaviour... or am I missing something?

Nov 2, 2010 at 7:41 AM

daVinci,  This item was posted back in June and, if I am not mistaken, at that time (pre-2.0) you could not embed Fluent in System.Windows.Window.  Because you can now use System.Windows.Window with the new version - either the above code or using System.Windows.Window may be a solution.  The biggest problem we have is that we use a WindowsFormsHost control and on-resize excessive and repetitive flickering occurs in our WindowsFormsHost control.  This, I admit, is partly a problem of a WindowsFormsHost control being used within WPF, but the flicker is extreme when used in combination with Fluent Ribbon.  We use the WindowsFormsHost control in a non-Fluent ribbon application and the flicker is very minor. 

Another user in this forum has this same problem - see http://fluent.codeplex.com/Thread/View.aspx?ThreadId=227980.  I do realize that removing the minimize/maximize button or specifying a ToolWindow is in violation of the MS standards/license, but end-users will not abide the extreme flickering of the WindowsFormsHost control.  If you would like to see the problem, we can setup a webex remote connection for you.  This could be anytime that works for you - am or pm - after Wednesday this week.  I would simply send you the source, but our control is hooked to a SQL database and cannot load/execute without the back-end. Thanks Kristi

Nov 2, 2010 at 9:16 AM
daVinci wrote:

You can use System.Windows.Window if you want a regular behaviour... or am I missing something?

daVinci, yes you are missing something.

what I want is a homogeneous UI layout. What I really like are your RibbonWindow themes. These I would like to populate across all dialogues. Again, there are a couple of ways how to do that. However, the easiest and cleanest is if you inherit all and everything from one base window. And it would be more than just nice to use the RibbonWindow to create the requested ToolWindow.

I cannot see that including back standard WindowStyle properties could violate against any license agreements, since it is standard.

BTW - I hate to fiddle around in source code, since it just creates headache for subsequent updates. Therefore, I would appreciate your feedback if you will include the proposed or another solution for a ToolWindow in your source. Otherwise, I need to consider a different route.

Thanks

Vdue

Dec 14, 2010 at 12:09 PM

Does anyone know if Microsoft plans to adjust this license? It seems a bit draconian! All I want to do is have my RibbonWindow without the Minimize/Maximize buttons visible... I don't want to change anything else about the appearance..

I would have thought that having the ribbon work in a modal window or WindowStyle None window would be something routinely needed....