locked
GridSplitter.Cursor not chaning RRS feed

  • Question

  • Hi All,

    I have rehosted a workflow designer in WPF. I have a WPF widow with 5 columns [0 - 4], columns 1 and 3 are empty columns with Grid Splitters. Unfortunately the cursor will not change to "SizeWE" on a mouse enter event, nor if the cursor property is changed for the column or to the grid splitter itself. Can any one provide some insight as to why it's not changing?

     <Grid Name="rehostGrid">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="10*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
    
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="3*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="7*"/> 
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="3*"/>
            </Grid.ColumnDefinitions>
       
            <Border Grid.Column="0" Grid.Row="0" Name="MenuBorder"/>
            
            <Border Grid.Column="0" Grid.Row="1" Name="ActivityBorder"/>
            <Border Grid.Column="2" Grid.Row="1" Name="DesignerBorder"/>
            <Border Grid.Column="4" Grid.Row="1" Name="PropertyBorder"/>
            
            <Border Grid.ColumnSpan="5" Grid.Row="2" Name="DebuggerBorder"/>
    
            <GridSplitter Name="Splitter1" HorizontalAlignment="Right" 
                      VerticalAlignment="Stretch" 
                      Grid.Column="1" ResizeBehavior="PreviousAndNext"
                      Width="5" Background="#FFBCBCBC"
                      Grid.Row="1"
                      Cursor="SizeWE"/>
    
            <GridSplitter Name="Splitter2" HorizontalAlignment="Right" 
                      VerticalAlignment="Stretch" 
                      Grid.Column="3" ResizeBehavior="PreviousAndNext"
                      Width="5" Background="#FFBCBCBC"
                      Grid.Row="1"
                     Cursor="SizeWE"/>
    
    Thursday, March 18, 2010 8:39 PM

All replies

  • Did you ever come up with anything on this issue?   I'm having pretty much the same problem with the WF4 WorkflowDesigner views in adjacent columns to the GridSplitter columns.
    Wednesday, May 12, 2010 5:59 PM
  • Im getting exact same problem with re-hosting the WF4 designer.
    Friday, May 28, 2010 10:51 AM
  • Hi Bob & T Rex (Sorry I missed your post Bob)

    I have used a work around, as I was still not able to change the cursor on the gridsplitter component. I now use the Mouse.OverrideCursor as follows:

     

    private void GridSplitter_MouseEnter(object sender, MouseEventArgs e)
    {
     Mouse.OverrideCursor = Cursors.SizeWE;
    }
    
    private void GridSplitter_MouseLeave(object sender, MouseEventArgs e)
    {
     Mouse.OverrideCursor = Cursors.Arrow;
    }

     

    In the RehostedDesigner.XAML i have added following XAML code:

    < GridSplitter HorizontalAlignment ="Right"

                      VerticalAlignment ="Stretch"

                      Grid.Column ="1" Grid.Row ="1" ResizeBehavior ="PreviousAndNext"

                      Width ="5" Background ="CornflowerBlue" Mouse.MouseEnter ="GridSplitter_MouseEnter" Mouse.MouseLeave ="GridSplitter_MouseLeave"/>

    The obvious danger is this changes the mouse cursor for ALL applications, so if you fail to change it back on MouseLeave, then the cursor will always be the SizeWE! :(

    Hope that helps.

    Cheers

    James

    Friday, May 28, 2010 11:22 PM