Open new windows

Aug 31, 2013 at 9:16 PM
Hello,

I've made a function to be triggered on clicking a button. The code is
ModernWindow vWinViewCache = new ModernWindow
{
    Content = new GclTabAddItemNew(),
};
vWinViewCache.ShowDialog();
The strange this is that the window shown is empty. If I change it to a normal window the layout is correct. the content is a file with this content
<UserControl x:Class="GeoCacheLog.Views.GclAppSettings"
             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" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <ScrollViewer>
            <StackPanel MinWidth="200">
                <TextBlock Text="TODO: add application page containing the settings" />
            </StackPanel>
        </ScrollViewer>
    </Grid>
</UserControl>
Any ideas why this doesn't work?
Coordinator
Sep 1, 2013 at 12:04 PM
The default ModernWindow style ignores the value of the Content property. Content is rendered using a ModernFrame and the ContentSource property. If you need to render plain Content I would suggest using the EmptyWindow style, which does render Content.
var wnd = new ModernWindow {
 Style = (Style)Application.Resources["EmptyWindow"]
};
Sep 1, 2013 at 1:13 PM
Thanks for the answer and 'hidden' tip :-)

Is so was that today I messed with setting the image source of an image object. Reading your answer I set the ContentSource the same way, but then ofcourse to a xaml file. That works as a charm.