gpt4 book ai didi

c# - 使用 MahApps Metro 主题 VS2013

转载 作者:可可西里 更新时间:2023-11-01 08:50:34 26 4
gpt4 key购买 nike

我正在尝试执行此处的入门说明:http://mahapps.com/MahApps.Metro/guides/quick-start.html .

我已经获得了最新的预发布版(也尝试过稳定版),但我没有获得指南生成的相同窗口。我得到一个透明的窗口和标题栏,所以它看起来像一个 float 的标题栏,以及最小化、最大化和关闭按钮。

当我添加样式时,我得到一个带有蓝色标题栏的白色背景,但没有阴影。我是不是做错了什么或者有其他人遇到过这种情况吗?

谢谢。

编辑:这是 XAML

主窗口

<Controls:MetroWindow x:Class="Metro.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
Title="MainWindow" Height="900" Width="1600">
</Controls:MetroWindow>

应用程序.xaml

<Application x:Class="Metro.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

正如我提到的,我按照入门说明进行操作,复制并粘贴了完全相同的代码,但得到了不同的结果。

最佳答案

编辑quick start指南和 MetroWindow help现已更新(2014 年 9 月 4 日)。

快速入门中的屏幕截图/示例未完全更新。

可以有边框

<controls:MetroWindow x:Class="MahApps.Metro.Simple.Demo.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"
Title="MainWindow"
Height="200"
Width="600"

BorderBrush="{DynamicResource AccentColorBrush}"
BorderThickness="1"

WindowStartupLocation="CenterScreen">

</controls:MetroWindow>

enter image description here

或发光边框

<controls:MetroWindow x:Class="MahApps.Metro.Simple.Demo.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"
Title="MainWindow"
Height="200"
Width="600"

GlowBrush="{DynamicResource AccentColorBrush}"

WindowStartupLocation="CenterScreen">

</controls:MetroWindow>

enter image description here

或阴影

<controls:MetroWindow x:Class="MahApps.Metro.Simple.Demo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:behaviours="http://metro.mahapps.com/winfx/xaml/shared"
Title="MainWindow"
Height="200"
Width="600"
ResizeMode="CanResizeWithGrip"
WindowTransitionsEnabled="False"
WindowStartupLocation="CenterScreen">

<i:Interaction.Behaviors>
<behaviours:BorderlessWindowBehavior AllowsTransparency="False"
EnableDWMDropShadow="True" />
<behaviours:WindowsSettingBehaviour />
<behaviours:GlowWindowBehavior />
</i:Interaction.Behaviors>

</controls:MetroWindow>

更新

EnableDWMDropShadow 已移至 MetroWindow 版本 0.13 alpha(最新版本)

<controls:MetroWindow x:Class="MahApps.Metro.Simple.Demo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:behaviours="http://metro.mahapps.com/winfx/xaml/shared"
Title="MainWindow"
Height="200"
Width="600"

EnableDWMDropShadow="True"
ResizeMode="CanResizeWithGrip"

WindowTransitionsEnabled="False"
WindowStartupLocation="CenterScreen">

</controls:MetroWindow>

enter image description here

希望对你有帮助

关于c# - 使用 MahApps Metro 主题 VS2013,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22265415/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com