wpfui icon indicating copy to clipboard operation
wpfui copied to clipboard

Xaml preview not looking like built gui

Open Alekwv opened this issue 5 months ago • 1 comments

Describe the bug

Hey,

A bit newb to this but this project looks good!! Im looking to design a modern gui in VS Studio, to use it in my powershell using the logic below:

Add-Type -LiteralPath ".\Wpf.Ui.dll"
Add-Type -AssemblyName PresentationFramework
 
[xml]$xaml = @"
<ui:FluentWindow
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
    x:Name="Window">
 
    <ui:FluentWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ui:ThemesDictionary Theme="Dark" />
                <ui:ControlsDictionary />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </ui:FluentWindow.Resources>
 
    <StackPanel>
        <ui:TitleBar Title="WPF UI Title Bar"/>
        <TextBlock Padding="10">This is a WPF window styled to look like WinUI 3!</TextBlock>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
            <TextBox x:Name="MyTextBox" Width="150" />
            <ui:Button x:Name="SubmitButton" Content="Submit" Margin="5" />
        </StackPanel>
    </StackPanel>
</ui:FluentWindow>
"@
 
$reader = (New-Object System.Xml.XmlNodeReader $xaml)
$window = [Windows.Markup.XamlReader]::Load($reader)
$window.ShowDialog()

However when creating a new brand new C# WPF Project (net 8.0) using this tutorial: https://wpfui.lepo.co/documentation/nuget.html

My gui looks like this in development view (i would like to drag and drop items etc etc edit it just like in OG XAML):

Image

and this is what it looks like once ran (yes i can edit code here and hot-reload but preview window drag n drop would be my preferred way of creating the gui):

Image

My current xaml is this:

<ui:FluentWindow x:Class="WpfApp1.MainWindow"
        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:ui="http://schemas.lepo.co/wpfui/2022/xaml"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">

    <ui:FluentWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ui:ThemesDictionary Theme="Dark" />
                <ui:ControlsDictionary />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </ui:FluentWindow.Resources>
    
    <Grid Margin="451,263,0,0">
        <ui:SymbolIcon Symbol="Fluent24"/>
        <ui:Button Content="Button" Margin="-305,-156,0,0" VerticalAlignment="Top"/>
    </Grid>
</ui:FluentWindow>

To Reproduce

do the following above

Expected behavior

Work in xaml preview so i can drag n drop and edit precisely

Screenshots

No response

OS version

Windows 11

.NET version

8.0

WPF-UI NuGet version

The one in Visual Studio (newest?)

Additional context

No response

Alekwv avatar Jul 16 '25 07:07 Alekwv