views:

55

answers:

1

Hello.
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#.
The application resizes sideways only (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).
I only need to change the cursor that appears over the 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 ControlTemplate trial (I fixed that in the question now).

+1  A: 

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.

Groky
Yes, with a ScrollWE I still see the diagonal cursor when using the ControlTemplate.Regarding your example, when I add a resizegrip of my own, how can I tie it to a resize of the window?I use grids, so I adapted your example to<ResizeGrip Grid.Column="3" Cursor="ScrollWE" VerticalAlignment="Bottom" />(Column=3 is the last column).It isn't resizing the window, maybe because it's working over the column only (which is, BTW, a fixed size column).What happens, is that the window is dragged (moved).
SGershon