punker76 / MahApps.Metro.SimpleChildWindow

A simple child window for MahApps.Metro
MIT License
374 stars 55 forks source link

Question: Child Window #86

Closed Torchok19081986 closed 5 years ago

Torchok19081986 commented 5 years ago

Hallo, i have a question and hope someone can help me with. I set succesffuly childwindow in my testproject. Unfortunately Page in WPF and c# doenst show any content. I just added one Button and one textbox in WPF new Page for new CoolChildWindow, but it doesnt show my controls. It looks like new usercontrol. if i start my testproject with child window, it shows all new added controls.

Following pacakges are from Nuget installed: package id="ControlzEx" version="3.0.2.4" package id="MahApps.Metro" version="1.6.5" package id="MahApps.Metro.IconPacks" version="2.3.0" package id="MahApps.Metro.IconPacks.FontAwesome" version="2.3.0" package id="MahApps.Metro.IconPacks.Material" version="2.3.0" package id="MahApps.Metro.IconPacks.Modern" version="2.3.0" package id="MahApps.Metro.SimpleChildWindow" version="1.5.0"

I use Visual Studio 2019 and .NET Framework 4.7 .

punker76 commented 5 years ago

@Torchok19081986 Do you mean the designer view?

Torchok19081986 commented 5 years ago

Hallo @punker76 . Yes, i mean designer view. In designer view new Childwindow looks empty, only empty window with some lines.

JohnFredMeyer commented 5 years ago

@Torchok19081986 Can you make sure you have IsOpen Set to True in Xaml and you have set DesignHeight and DesignWidth. Like so

IsOpen="True"

<simpleChildWindow:ChildWindow   x:Class="YourXClass"
    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:simpleChildWindow="http://metro.mahapps.com/winfx/xaml/simplechildwindow"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
    d:DesignHeight="300"
    d:DesignWidth="350"
    mc:Ignorable="d"
    IsOpen="True"
    ChildWindowHeight="300"
    ChildWindowWidth="350">
</simpleChildWindow:ChildWindow>
punker76 commented 5 years ago

@Torchok19081986 The simplest way is to put your view in to a separate UserControl and use this at the ChildWindow. The other way is to set the IsOpen property to true as @JohnFredMeyer suggested.