Using Fluent in .Net 4.0

Feb 3, 2010 at 4:14 PM

FYI,

I am using Fluent compiled in .Net 4.0 after tracking down the source of an issue with the sizing of the client area. When running in a .Net 4.0 environment, the client area ends up extending past the right and bottom borders of the main window. I don't know what's causing the difference in behavior, but the work around is simple:

In method DwmInit() of class RibbonWindow (RibbonWindow.cs) change the last execution statement from This:

mainGrid.Margin = new Thickness(sizers.Left, 
                                sizers.Top,
                                -borderWidth * 2 + sizers.Left,
                                -SystemParameters.CaptionHeight - 1 - borderHeight * 2 + sizers.Top);

 

To This:

mainGrid.Margin = new Thickness(borderWidth, borderHeight, borderWidth, borderHeight);

By the way, nice job. Fluent ribbon is looking good. Probably the best free ribbon control currently available.

Coordinator
Feb 3, 2010 at 5:14 PM

Hi, DonWingate.

First of all, thank you for your feedback.
You are right, it's a diference between .NET 3.5SP1 and  4.0 beta.
This will be fixed as soon as .NET 4.0 RC will released (I added the issue #16233 http://fluent.codeplex.com/WorkItem/View.aspx?WorkItemId=16233).

Daniel

Feb 9, 2010 at 11:04 AM
Edited Feb 9, 2010 at 9:06 PM

Is anybody else having trouble debugging a .NET 4 RC app with the Fluent ribbon?

 

Platform: Win7, DWM enabled, .NET 4 RC, VS.NET 2010 RC.

Steps to reproduce:

1) Download latest fluent source checkin.

2) Open SLN in VS 2010 RC.

3) Change both projects to compile against .NET 4 (compiles fine).

4) Press F5 to start debugging. Exception will occur shortly after FluentTest starts up.

 

RibbonWindow.cs - inside UpdateWindowStyle()
Exception thrown on NativeMethods.SetWindowLong(handle, NativeMethods.GWL_STYLE, style);
MDA message: PInvokeStackImbalance was detected
Message: A call to PInvoke function 'Fluent!Fluent.NativeMethods::SetWindowLong' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

RibbonWindow.cs - inside UpdateWindowStyle()

Exception thrown on NativeMethods.SetWindowLong(handle, NativeMethods.GWL_STYLE, style);

MDA message: PInvokeStackImbalance was detected

Message: A call to PInvoke function 'Fluent!Fluent.NativeMethods::SetWindowLong' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

 

I somehow got it working (setting all build targets in my app to "Any CPU" - it was x86 before).

> By the way, nice job. Fluent ribbon is looking good. Probably the best free ribbon control currently available.

It looks fantastic compared to the RibbonControlsLibrary CTP. Even under XP is looks great!

 

-Mike-

Feb 13, 2010 at 3:10 AM

The demo looks awesome, I'm just waiting for a .NET 4 compatible build.

Coordinator
Feb 13, 2010 at 7:07 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Feb 13, 2010 at 7:21 AM
Edited Feb 13, 2010 at 7:25 AM

Thanks, Mike. PInvoke issues will be eliminate in BETA2.

Grauenwolf, Thank you for your evaluation.
I believe that BETA2 will be compatible with NET 4.0.
But you know .NET 4.0 has new text rendering and we need some time to make styles look exactly as Microsoft Office 2010. So fully compatible release will be looked better.