【WPF+Prism】日常开发问题总结
【WPF+Prism】日常开发问题总结目录
- 窗口去掉导航栏与设置圆角后出现白边
窗口去掉导航栏与设置圆角后出现白边
先说问题,在开发登录窗口的过程中,Prism需要不能使用Window窗口作用在导航中,所以使用UserControl
先使用一下代码对窗口进行美化
<UserControlx:Class="BJ.UI.Views.LoginView"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:btnConrtol="clr-namespace:BJ.UI.CostomControls"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:prism="http://prismlibrary.com/"Width="580"Height="320"prism:ViewModelLocator.AutoWireViewModel="True"mc:Ignorable="d"><prism:Dialog.WindowStyle><Style TargetType="Window"><!-- 窗体的宽和高根据内容的大小设置 --><Setter Property="Background" Value="Transparent" /><Setter Property="SizeToContent" Value="WidthAndHeight" /><Setter Property="AllowsTransparency" Value="True" /><!-- 窗体样式清空 --><Setter Property="WindowStyle" Value="None" /><!-- 不允许调整窗体尺寸 --><Setter Property="ResizeMode" Value="NoResize" /><!-- 设置窗体的启动位置在屏幕中间 --><Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterScreen" /></Style></prism:Dialog.WindowStyle><Border
主要问题就是Background
这个写在哪里,一开始我写在了UserControl中,白边依然显示,挪到WindowStyle
中则解决问题