firstfloorsoftware / mui

Modern UI for WPF
Microsoft Public License
2.6k stars 754 forks source link

How do we put just the contents of a user control into a ModernWindow?? #75

Open Rod-in-NM opened 8 years ago

Rod-in-NM commented 8 years ago

We've been struggling with this problem literally for days. We writing a WPF app using ModernUI and MVVM Light. One of the requirements is that when a user clicks on a button in the main form, that it MUST open a new window with the data displayed in it. Not the way that ModernUI does it with the contents of a user control appearing in the third column of a grid. I've tried many things, all of which are failing. All we get is a blank window, with the usual chrome provided by ModernUI (the back arrow, linear gradient, etc.). Finally in frustration I tried doing the same thing with a regular WPF window. It works perfectly. But of course now we don't have the styling that ModernUI provides. Below is the XAML for the ModernWindow we've been struggling with, please tell me what we're doing wrong/leaving out (please note that I'm in some of the attempts we've made. There's a LOT MORE that I've removed, but its enough to let you know what it is we're struggling with):

<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" />-->
<!--<ContentControl
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch">
    <ContentControl.Content>
        <view:ProductListView />
    </ContentControl.Content>
</ContentControl>-->
<!--<ContentControl x:Name="cc"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch" />-->

<!--<TextBlock Text="Here I am" HorizontalAlignment="Center" VerticalAlignment="Center" />-->
<!--<view:ProductListView />-->
<ContentControl Content="{Binding Source={StaticResource Locator}, Path=ProductList}" />

/mui:ModernWindow

motisoft commented 8 years ago
<mui:ModernWindow>
<mui:ModernWindow.BackgroundContent>
<ContentControl Content="{Binding Source={StaticResource Locator}, Path=ProductList}" />
</mui:ModernWindow.BackgroundContent>
</mui:ModernWindow>

That is the hierarchy, i found that myself after investigating the API with ILSpy. @Rod-in-NM

Rod-in-NM commented 8 years ago

Thank you @motisch. BTW, I'm not familiar with ILSpy, but will look it up. Thanks!