MahApps / MahApps.Metro

A framework that allows developers to cobble together a better UI for their own WPF applications with minimal effort.
https://mahapps.com
MIT License
9.23k stars 2.45k forks source link

Question: How to use template in visual studio 2019 #3635

Closed Torchok19081986 closed 4 years ago

Torchok19081986 commented 4 years ago

Hallo everyone, i have some trouble in vs 2019. I just downloaded template and crearte new project from template. Unfortunatally, in vs 2019 seems doenst show tempalte in designer on mainwindow.xaml, only if i execute it. Code for startwindow got from tutorials and quick start.

<Controls:MetroWindow
    x:Class="ProjectfromTemplate.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
    xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
    Title="MainWindow"
    Width="525"
    Height="350"
    WindowStartupLocation="CenterScreen">
    <Controls:MetroWindow.RightWindowCommands>
        <Controls:WindowCommands>
            <Button Content="settings" />
            <Button>
                <StackPanel Orientation="Horizontal">
                    <iconPacks:PackIconModern
                        Width="24"
                        Height="24"
                        Kind="FoodCupcake" />
                    <TextBlock
                        Margin="4,0,0,0"
                        VerticalAlignment="Center"
                        Text="deploy cupcakes" />
                </StackPanel>
            </Button>
        </Controls:WindowCommands>
    </Controls:MetroWindow.RightWindowCommands>
    <Grid />
</Controls:MetroWindow>

i use visual studio 2019 and target .net framework 4.7.2.

P.S.: after i created new project from template , i update mahapps.metro libraries to newest 2.0 .

Can someone help me with my "question" or suggest workaround ?

punker76 commented 4 years ago

Unfortunatally, in vs 2019 seems doenst show tempalte in designer on mainwindow.xaml, only if i execute it.

@Torchok19081986 Can you post a screenshot? Which MahApps version do you use?

Torchok19081986 commented 4 years ago

Hallo, @punker76. Looks folowing in WPF Designer: Window I use MahApps.Metro Version 2.0 and Project was create as normal WPF C# for .NET Framework not Core Application. After i start my project my mainwindow looks folowing: Window 2 As Packages are referenced: package id="ControlzEx" version="4.1.0" targetFramework="net472" package id="MahApps.Metro" version="2.0.0-alpha0490" targetFramework="net472" package id="MahApps.Metro.IconPacks" version="3.0.0-alpha0223" targetFramework="net472" package id="Microsoft.Xaml.Behaviors.Wpf" version="1.0.1" targetFramework="net472"

punker76 commented 4 years ago

@Torchok19081986 The designer can't display the caption of a Window. So you will also don't see the window commands or min/max/close buttons. This is a designer limitation.