Skip to content

A Swiss Army knife for developers.

1.9 KB
Raw Blame
<controls:MicaWindowWithOverlay
    x:Class="DevToys.Windows.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:devtoysblazor="clr-namespace:DevToys.Blazor;assembly=DevToys.Blazor"
    xmlns:core="clr-namespace:DevToys.Core;assembly=DevToys.Core"
    xmlns:controls="clr-namespace:DevToys.Windows.Controls"
    xmlns:webview="clr-namespace:DevToys.Windows.Controls.WebView"
    xmlns:blazor="clr-namespace:Microsoft.AspNetCore.Components.WebView.Wpf;assembly=Microsoft.AspNetCore.Components.WebView.Wpf"
    d:DataContext="{d:DesignInstance Type=core:TitleBarInfoProvider}"
    mc:Ignorable="d"
    Loaded="MainWindow_Loaded"
    Closing="MainWindow_Closing"
    MinWidth="600"
    MinHeight="400"
    Title="{Binding TitleWithToolName}"
    TitleBarMarginLeft="{Binding TitleBarMarginLeft}"
    TitleBarMarginRight="{Binding TitleBarMarginRight}"
    TitleBarWindowStateButtonsWidth="{Binding TitleBarWindowStateButtonsWidth, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}">
    <Grid>
        <!-- Interestingly, on some monitors, setting a margin of 2px makes the BlazorWebView rendering a white line in diagonale.
             See https://github.com/veler/DevToys/issues/878 -->
        <webview:CustomBlazorWebView
            x:Name="blazorWebView"
            Margin="0"
            HostPage="wwwroot/index.html"
            Services="{StaticResource services}">
            <webview:CustomBlazorWebView.RootComponents>
                <blazor:RootComponent Selector="#app" ComponentType="{x:Type devtoysblazor:Main}"/>
            </webview:CustomBlazorWebView.RootComponents>
        </webview:CustomBlazorWebView>
    </Grid>
</controls:MicaWindowWithOverlay>