Modifying the cursor of a resize grip in a WPF window ("CanResizeWithGrip" + "WindowStyle:none")
Seems ilke none of the other StackOverflow questions answers this specific question. Or it may be lousy search skills...
I have a ("CanResizeWithGrip
" + "WindowStyle="none"
") application written in WPF
/ C#
.
MaxHeight
and MinHeight
are the same), so I would want the cursor of the ResizeGrip
to be ScrollWE
(horizontal only) instead of the diagonal default.
Users try to resize vertically when the cursor hints them they can.
I tried to modify the control template by using the code below, but then the whole window disappears and I'm left only with the resizegrip UI -- and still a diagonal cursor!
<Window.Template>
<ControlTemplate TargetType="Window">
<ResizeGrip Cursor="ScrollWE" />
</ControlTemplate>
</Window.Template>
Resizing is working properly, the window is stylized properly (when I don't use the ControlTemplate
above).
ResizeGrip
. How to do that?
Hints on directions to follow are welcome too (complete answers even more :)).
Edit: Hans is right on his comment. I mistakenly used ScollSE in my Con开发者_如何学CtrolTemplate trial (I fixed that in the question now).
If I create a window with the following markup
<Window x:Class="PocketExample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<DockPanel>
<ResizeGrip DockPanel.Dock="Bottom" Cursor="SizeWE"/>
</DockPanel>
</Window>
I get the correct cursor. Does this not work for you? Are you really using a ScrollSE cursor? As Hans points out, that is a diagonal cursor which would explain why you're getting a diagonal cursor.
精彩评论