【发布时间】:2013-03-03 00:54:09
【问题描述】:
我知道以前有人问过这个问题,但我已经尝试过答案:
- How to create a WPF Window without a border that can be resized via a grip only?
- How to remove the title bar from a window but keep the border
两者都不起作用,标题栏文本就在那里,我无法将我的网格移动到窗口的顶部,这样网格就占据了整个窗口。我被困在这上面了。
窗口的 XAML:
<Window x:Class="PlayWPF.TimerSlideWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="" Height="95" Width="641" WindowStyle="None"
ResizeMode="CanResize" AllowsTransparency="False">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Slider Height="42" HorizontalAlignment="Left" Margin="10,14,0,0"
Name="sldTime" VerticalAlignment="Top" Width="495" />
<TextBox FontSize="18" Height="29" HorizontalAlignment="Left"
Margin="510,10,0,0" Name="txtTime" Text="00:00:00"
TextAlignment="Center" VerticalAlignment="Top" Width="93" />
</Grid>
</Window>
【问题讨论】:
-
@HighCore 所说的......您链接的帖子中的代码工作正常。
-
WindowStyle="None"这不正是您要找的吗??? -
@SandraWalters 这很有趣,也很讽刺(因为有成群的开发人员抱怨 XAML 太难读了)我到底怎么感觉阅读 XAML 比阅读英文更舒服......这发生在你身上吗?
-
@HighCore 阅读 Xaml 非常有意义;阅读 VB 让我想睁大眼睛 :)
-
如果我理解正确,代码会做你想做的事。但如果你还希望它最大化,添加 WindowState="Maximized"...