问题描述
如果您设置 ResizeMode =CanResizeWithGrip
在一个WPF 窗口
则调整大小握显示在低右侧角球,如下:
如果您设置 WindowStyle =无
以及标题栏消失,但是灰斜边保持,直到您设置 ResizeMode =NoResize
。不幸的是,设置属性的组合,调整大小的抓地力也消失了。
我已经覆盖了窗口
的控件模板
通过自定义风格
。我想指定窗口自己的边界,而我不需要用户能够从四面调整窗口的大小,但我确实需要一个调整大小的抓地力。
有人细节一个简单的方法能满足所有这些标准?
- 不要对
窗口边框
除了一个我指定自己在一个控件模板
。 - 不要有一个工作在右下角调整的抓地力。
- 不要标题栏。
如果您设置了窗口
(即使没有设置任何透明度值)的边界消失,你只能通过抓调整。 AllowsTransparency
属性
<窗口
的xmlns =http://schemas.microsoft.com/winfx/2006/xaml/$p$psentation
的xmlns:X =http://schemas.microsoft.com/winfx/2006/xaml
WIDTH =640高度=480
WindowStyle =无
AllowsTransparency =真
ResizeMode =CanResizeWithGrip>
<! - 内容 - >
< /窗>
结果是这样的:
If you set ResizeMode="CanResizeWithGrip"
on a WPF Window
then a resize grip is shown in the lower right corner, as below:
If you set WindowStyle="None"
as well the title bar disappears but the grey bevelled edge remains until you set ResizeMode="NoResize"
. Unfortunately, with this combination of properties set, the resize grip also disappears.
I have overridden the Window
's ControlTemplate
via a custom Style
. I want to specify the border of the window myself, and I don't need users to be able to resize the window from all four sides, but I do need a resize grip.
Can someone detail a simple way to meet all of these criteria?
- Do not have a border on the
Window
apart from the one I specify myself in aControlTemplate
. - Do have a working resize grip in the lower right corner.
- Do not have a title bar.
If you set the AllowsTransparency
property on the Window
(even without setting any transparency values) the border disappears and you can only resize via the grip.
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="640" Height="480"
WindowStyle="None"
AllowsTransparency="True"
ResizeMode="CanResizeWithGrip">
<!-- Content -->
</Window>
Result looks like:
这篇关于如何创建一个WPF窗口,不能够仅通过把手被调整的边界?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!