GridSplitter Cursor
-
I have a WPF form with a gridsplitter. The cursor is set to SizeWE, but it does not show the resize cursor on a mouseover. I can use it for resizing, so the control can grab the mouse. Has anyone seen this problem? Any ideas?
Johan Lombaard Only two things are infinite, the universe and human stupidity, and I'm not sure about the former - Albert Einstein
-
I have a WPF form with a gridsplitter. The cursor is set to SizeWE, but it does not show the resize cursor on a mouseover. I can use it for resizing, so the control can grab the mouse. Has anyone seen this problem? Any ideas?
Johan Lombaard Only two things are infinite, the universe and human stupidity, and I'm not sure about the former - Albert Einstein
Can you post your XAML please.
Cheers, Karl
» CodeProject 2008 MVP, CodeProject 2009 MVP My Blog | Mole's Home Page | XAML Power Toys Home PageJust a grain of sand on the worlds beaches.
-
I have a WPF form with a gridsplitter. The cursor is set to SizeWE, but it does not show the resize cursor on a mouseover. I can use it for resizing, so the control can grab the mouse. Has anyone seen this problem? Any ideas?
Johan Lombaard Only two things are infinite, the universe and human stupidity, and I'm not sure about the former - Albert Einstein
hi, try to set the cursor directly to the gridspliter. you can do this in you constructor mygridSpliter.Cursor = Cursors.SizeWE;
-
hi, try to set the cursor directly to the gridspliter. you can do this in you constructor mygridSpliter.Cursor = Cursors.SizeWE;
Setting the splitter cursor does not seem to work either. My code from the mouseEnter event. private void GridSplitter_MouseEnter(object sender, MouseEventArgs e) { GridSplitter gridSplitter = sender as GridSplitter; if (gridSplitter.Name == "Splitter1") { Splitter1.Cursor = Cursors.SizeWE; } }
-
Can you post your XAML please.
Cheers, Karl
» CodeProject 2008 MVP, CodeProject 2009 MVP My Blog | Mole's Home Page | XAML Power Toys Home PageJust a grain of sand on the worlds beaches.
Hi, I have exactly the same problem. here is my complete code:
<Grid Background="SteelBlue" x:Name="mainGrid"> <Grid.ColumnDefinitions> <ColumnDefinition Width="250"/> <ColumnDefinition Width="2\*" /> <ColumnDefinition Width="250" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition Height="25" /> </Grid.RowDefinitions> <Border BorderThickness="4" BorderBrush="SteelBlue" Background="White"> <WFDesigner:WorkflowListView x:Name="WorkflowList" Margin="10"/> </Border> <WFDesigner:WorkflowDetailView x:Name="WorkflowDetail" Margin="0,4" Grid.Column="1" Background="White"/> <GridSplitter HorizontalAlignment="Right" Grid.Column="1" ResizeBehavior="CurrentAndNext" Width="4" Background="Red" /> <Border BorderThickness="0,4,4,4" BorderBrush="SteelBlue" Grid.Column="2" Background="White"> <Grid x:Name="ToolboxProperties" DockPanel.Dock="Right"> <Grid.RowDefinitions> <RowDefinition Height="2\*" /> <RowDefinition Height="1\*" /> </Grid.RowDefinitions> <ContentControl Content="{Binding ToolboxControl}"/> <ContentControl DataContext="{Binding SelectedItem}" Content="{Binding Designer.PropertyInspectorView}" Grid.Row="1"/> </Grid> </Border> <StatusBar Grid.Row="1" Grid.ColumnSpan="3" > <TextBlock Text="{Binding Status}" Margin="5,0" /> </StatusBar> </Grid>
I tried overriding it by setting "Cursor" value in the GridSplitter XAML definition but it didn't work. Any idea?
-
Hi, I have exactly the same problem. here is my complete code:
<Grid Background="SteelBlue" x:Name="mainGrid"> <Grid.ColumnDefinitions> <ColumnDefinition Width="250"/> <ColumnDefinition Width="2\*" /> <ColumnDefinition Width="250" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition Height="25" /> </Grid.RowDefinitions> <Border BorderThickness="4" BorderBrush="SteelBlue" Background="White"> <WFDesigner:WorkflowListView x:Name="WorkflowList" Margin="10"/> </Border> <WFDesigner:WorkflowDetailView x:Name="WorkflowDetail" Margin="0,4" Grid.Column="1" Background="White"/> <GridSplitter HorizontalAlignment="Right" Grid.Column="1" ResizeBehavior="CurrentAndNext" Width="4" Background="Red" /> <Border BorderThickness="0,4,4,4" BorderBrush="SteelBlue" Grid.Column="2" Background="White"> <Grid x:Name="ToolboxProperties" DockPanel.Dock="Right"> <Grid.RowDefinitions> <RowDefinition Height="2\*" /> <RowDefinition Height="1\*" /> </Grid.RowDefinitions> <ContentControl Content="{Binding ToolboxControl}"/> <ContentControl DataContext="{Binding SelectedItem}" Content="{Binding Designer.PropertyInspectorView}" Grid.Row="1"/> </Grid> </Border> <StatusBar Grid.Row="1" Grid.ColumnSpan="3" > <TextBlock Text="{Binding Status}" Margin="5,0" /> </StatusBar> </Grid>
I tried overriding it by setting "Cursor" value in the GridSplitter XAML definition but it didn't work. Any idea?
Hi, This is what I do
<GridSplitter Grid.Column="0" ResizeDirection="Columns" Background="LightGray" Width="5" MouseEnter="GridSplitter_MouseEnter" MouseLeave="GridSplitter_MouseLeave"/>
private void GridSplitter_MouseEnter(object sender, MouseEventArgs e)
{
if (this.Cursor != Cursors.Wait)
Mouse.OverrideCursor = Cursors.SizeWE;
}private void GridSplitter\_MouseLeave(object sender, MouseEventArgs e) { if (this.Cursor != Cursors.Wait) Mouse.OverrideCursor = Cursors.Arrow; }
I first check if the mouse is already in Waiting mode, as I dont want the users to be able to resize the app while I am doing some other stuff. Hope it helps