Question

I'm using ModernUI for WPF (MUI) available on codeplex here. It's a nice framework and I have no issues using it as a container for my pages.

I'm now trying to add a custom modal dialog, but declaring as a simple Window doesn't keep the nice style MUI has. I've been trying to understand the source code but I can't figure out how to create a window like it does.

Can someone please give me a couple of guidelines on how to achieve a custom modal dialog with this framework?

EDIT: This is the solution I've found with the help of XAMlMAX:

<mui:ModernWindow
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:lex="http://wpflocalizeextension.codeplex.com" 
xmlns:SysClient="clr-namespace:SysClient" 
xmlns:System="clr-namespace:System;assembly=mscorlib" 
x:Class="SysClient.Pages.GenericWindow" 
xmlns:mui="http://firstfloorsoftware.com/ModernUI"    
mc:Ignorable="d" Width="800" Height="520" Activated="Window_Activated" Margin="0,0,0,0">
<Window.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/FirstFloor.ModernUI;component/Themes/ModernWindowPopUp.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Window.Resources>
<Window.Style>
    <StaticResource ResourceKey="ModernWindowPopUp"></StaticResource>
</Window.Style>

And this is how I use it:

  GenericWindow w = new GenericWindow()
  {
      Title = "Add Order",
      ShowInTaskbar = false,               // don't show the dialog on the taskbar
      //Topmost = true,                    // ensure we're Always On Top
      ResizeMode = ResizeMode.NoResize,    // remove excess caption bar buttons
      Owner = Application.Current.MainWindow,
      Tag = new ParametersClass(OrderTypeId),
      ContentSource = new Uri("/Windows/AddOrderWindow.xaml", UriKind.Relative)
  };
  w.ShowDialog();
Was it helpful?

Solution

Maybe I know enough to provide an answer: Here is the link to the source code of the markup for the layout: Button template this will give you basic understanding of how the application achieves it's look. After you downloaded the dictionaries just apply them to your modal window. And that should be enough to give you desired results :-)

Any probs just let us know

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top