Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
220
AllowsTransparency="True" in XamRibbonWindow causes crash in Win8 / Fails in Win7
posted

A client of mine has an application where they are attempting to customize the look of the application, chrome and all. Normally with <Window> you can simply set AllowsTransparecy="True" and WindowStyle="None" and knock yourself out (it's understood that you then have to completely take care of things like resizing, maximize, close, etc. on your own).

Anyway, it appears you cannot set this flag if you use XamRibbonWindow.

Creating a blank WPF app and swapping out the MainWindow.xaml with

<igRibbon:XamRibbonWindow x:Class="WindowTest.MainWindow"         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         xmlns:igRibbon="http://infragistics.com/Ribbon"         Title="MainWindow" Height="350" Width="525" ResizeMode="CanResizeWithGrip" WindowStyle="None"         AllowsTransparency="True">     <igRibbon:RibbonWindowContentHost>     </igRibbon:RibbonWindowContentHost> </igRibbon:XamRibbonWindow>

as well as changing the .cs class to inherit XamRibbonWindow, this crashes with the follow stack trace on Win8

   at System.Windows.Media.Composition.DUCE.Channel.SyncFlush()
   at System.Windows.Media.MediaContext.CompleteRender()
   at System.Windows.Interop.HwndTarget.OnResize()
   at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

I'm pushing for not overriding the chrome since the amount of effort involved isn't really worth the ROI, but this is an odd behavior I've been able to reproduce on several different machines.

On Win7, the app won't run at all. You doubleclick and nothing happens.

Is there something I am missing or is this a real issue?

Parents Reply
  • 54937
    Offline posted in reply to Robb

    If they want the window to have that look whether glass is on or not then you really need to use a regular Window and provide the chrome (yourself or maybe using something like the shell integration library). If they are ok with letting the OS provide the chrome (i.e. the background of the caption area and the OS caption buttons) when desktop composition (i.e. aero glass) is enabled but want the look you are describing when desktop composition is enabled then you might be able to provide custom styles/templates for the WindowContentHost & XamRibbon. When the xamRibbon is automatically collapsed (i.e. AutoHideEnabled is true and the window's width/height is below the AutoHideHorizontal|VerticalThreshold) the WindowContentHost provides the caption area otherwise the xamRibbon provides it since it needs to integrate the positioning of the QAT, etc so if you're not using the autohide functionality then you can just deal with the xamRibbon. If you want to go this route then you can look at the default xaml we provide as part of the install and create your own modified xamRibbon template. The template contains an element that defines the buttons so you can change the look of the buttons and the color of the title bar. Again this part is really only going to work when desktop composition is not enabled - at least currently; you could submit a suggestion for adding a property to the xamRibbon(Window) so it can opt out of supporting/using the glass.

Children
No Data