Building ModernUI in .NET4

Jul 18, 2013 at 2:16 PM
Edited Jul 18, 2013 at 2:48 PM
I just downloaded the latest source code for mui, and I tried to target .NET4.0 by changing the Target Framework and adding NET4 to the Conditional compilation symbols. It doesn't seem to build for me and I am wondering if I am missing a step or if the latest build requires .NET4.5 Thanks

I get the following errors
The tag 'WindowChrome' does not exist in XML namespace ''. Line 80 Position 18.    \FirstFloor.ModernUI\FirstFloor.ModernUI\Themes\ModernDialog.xaml
The property 'WindowChrome.IsHitTestVisibleInChrome' does not exist in XML namespace ''. Line 80 Position 147. y\FirstFloor.ModernUI\FirstFloor.ModernUI\Themes\ModernWindow.xaml
And then when I commented out all references to WindowChrome, I got a few more errors along the lines of
\FirstFloor.ModernUI\FirstFloor.ModernUI\Themes\ModernDialog.xaml(28,77): error MC3011: Cannot find the static member 'WindowNonClientFrameThickness' on the type 'SystemParameters'.
And then commenting out all the references to WindowNonClientFrameThickness, I got these errors:
FirstFloor.ModernUI\FirstFloor.ModernUI\Assets\ModernWindowEx.xaml(44,177): error MC3050: Cannot find the type 'SystemCommands'. Note that type names are case sensitive.
SystemCommands is not supported in a Windows Presentation Foundation (WPF) project. FirstFloor.ModernUI\FirstFloor.ModernUI\Assets\ModernWindowEx.xaml
I added a reference to Microsoft.Windows.Shell.dll thinking that might fix the issue, but that didn't help and now I am off to find out where the references to SystemCommands comes from

Okay --- so after adding the referense to Microsoft.Windows.Shell.dll and adding this reference to Themes\ModernWindow.xaml and Assets\ModernWIndowEx.xaml
and then prefixing all SystemCommand calls with "syscmd:" it successfully built. I am going to look back now and figure out if the previous stuff I commented out can just be prefixed with the same
Jul 18, 2013 at 2:45 PM
Edited Jul 18, 2013 at 2:49 PM
I was able to fix the SystemParamaters issue by modifying the Bindings for it.

I changed all the Bindings using SystemParameters to be like the following.

Changed From:
Margin="{Binding Source={x:Static SystemParameters.WindowNonClientFrameThickness}">
To: (Take note of the SystemParameters2)
Margin="{Binding Source={x:Static syscmd:SystemParameters2.Current}, Path='WindowNonClientFrameThickness'}">
Now 1.0.5 is building for me under .NET4 with these changes, there was probably an easier way =) But this got the job done.
Jul 18, 2013 at 2:52 PM
You do not need to change the .NET4.5 project, there's already a project targetting .NET4 available in the FirstFloor.ModernUI.WPF4 folder.
Jul 18, 2013 at 4:17 PM
Crazy! Ha. Thanks