0

We're working on a WPF app, using the ModernUI for WPF. And we're also using MVVM Light. We've written some user controls which we intend to bring up in separate windows. Each of the windows are ModernUI's ModernWindow. Whenever we try to bring them up, nothing is shown in the ModernWindow. Out of frustration I thought I'd try doing the same thing in a plain old WPF window. Works perfectly each time. I don't know why it works in a regular WPF window but doesn't work in a ModernWindow. What is wrong???

Here's the XAML for the plain old window:

<Window x:Class="CoreFramework.BozoWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:view="clr-namespace:CoreFramework.View"
    xmlns:local="clr-namespace:CoreFramework"
    mc:Ignorable="d"
    Title="Bozo Window" Height="300" Width="300">
<ContentControl Content="{Binding ProductList, Source={StaticResource Locator}}"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch" />

And here's the XAML for the ModernWindow:

<mui:ModernWindow x:Class="CoreFramework.DataViewWindow"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mui="http://firstfloorsoftware.com/ModernUI"
              xmlns:vm="clr-namespace:CoreFramework.ViewModel"
              xmlns:view="clr-namespace:CoreFramework.View"
              xmlns:content="clr-namespace:CoreFramework"
              Title="BOTS" 
              ShowInTaskbar="True"
              Closing="ModernWindow_Closing">

<ContentControl Content="{Binding Path=ProductList, Source={StaticResource Locator}}"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch" />

Rod
  • 4,107
  • 12
  • 57
  • 81
  • I found this blog that shows a simple setup for mvvmlight and modern ui. Maybe it can help you see what you're missing? [MVVMLight and ModernUI Part 1 - Setup](http://weblogs.asp.net/guystarbuck/mvvmlight-and-modernui-part-1-setup) – Smurfie Dec 02 '15 at 19:21
  • Thank you for your reply, Smurfie. I tried it, changing the DataViewWindow XAML to include: ContentSource="{Binding Path=ProductList, Source={StaticResource Locator}}" Unfortunately it didn't work. But at least I believe I'm probably closer. – Rod Dec 02 '15 at 20:26
  • I have used your code and it works for me perfectly. – AnjumSKhan Dec 03 '15 at 08:46
  • Shouldn't be anything wrong. Why don't you grab Snoop and look at the UI at runtime. Should give you a hint as to what's going on. Also, you're welcome for me introducing you to Snoop, if you didn't already know about it. –  Dec 03 '15 at 16:35
  • Will, thanks for suggesting Snoop. I've used it before, but didn't try it on this app. Just did. It didn't give me anything on the popup window (the ModernWindow launched by clicking on a button on the main window). In fact Snoop doesn't even seem to be aware of the popup window. – Rod Dec 03 '15 at 21:08

1 Answers1

0

One approach you could use is adding Menu links which is built into the Modern UI framework:

<mui:ModernWindow x:Class="ExampleApp.ExampleWindow"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mui="http://firstfloorsoftware.com/ModernUI"
         xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
         Title="Scrum Manager" IsTitleVisible="True" ContentSource="/Views/DefaultUserControl.xaml"
         x:Name="mainWindow"  MenuLinkGroups="{Binding Groups}"
         WindowStartupLocation="CenterScreen" WindowState="Maximized">
<i:Interaction.Triggers>

</i:Interaction.Triggers>
<mui:ModernWindow.TitleLinks>
    <mui:Link DisplayName="settings" Source="/Views/SettingsWindow.xaml" />
    <mui:Link DisplayName="Sign out" Source="/Infrastructure/Logout.xaml" />
</mui:ModernWindow.TitleLinks>

When a link is clicked, it opens up the 'Source' which would be UserControl xaml files.

See Github for more details: https://github.com/firstfloorsoftware/mui

Eamon Scullion
  • 1,354
  • 7
  • 16