开发者

WPF GridSplitter

I am experiencing weird behaviour whilst using the WPF GridSplitter.

I have the appropriate HorizontalAlignment properties set to stretch and when I resize them the GridSplitter jumps around, sometimes going back to their original positions or just jumping around as I drag them.....

Does anyone else seen or know what may be causing this?

Thanks

Here is the XAML

<GridSplitter x:Name="grdTreeSplitter" Grid.Row ="1" 
     BorderBrush="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}" 
     BorderThickness="1"
     HorizontalAlignment="Stretch" Panel.ZIndex="0" 
     ResizeBehavior="PreviousAndNext" ResizeDirection="Rows"
     SnapsToDevicePixels="False" ShowsPreview="False" UseLayoutRounding="False"
     DragIncrement="1"
     DragDelta="grdSideExpl开发者_如何学PythonorerSplitter_DragDelta">
  <GridSplitter.Visibility>
    <MultiBinding 
      ......
    </MultiBinding>
  </GridSplitter.Visibility>
</GridSplitter>


I had the same problem and found the same code works fine in Silverlight while it is broken in WPF, so I think it might be a problem with WPF. My fix was to roll out my own version of the GridSplitter, which is too big to put here, so you can see it on my blog.


I have the same problem it seems like we are drawing a lot of stuff. And if we have the ShowsPreview property set. The user can drag outside the grab-handle while it is trying to update the screen. But the user thread is supposed to be separate from the graphic rendering thread so I don't know. If the user selects the splitter and uses the up and down arrows on the keyboard it works fine also. Ah whilst writing this. I tried using larger values for dragincrement and that seems to work also. Better solution. This is with two gridsplitters in the same direction(three sections of screen) I don't know if that is also your setup.


My gridsplitter was jumping when I had width="1*" in grid columns. I've set size in pixels and it stopped jumping.


I realize this is old, but maybe this will help someone. I was having the issue where the splitter would jump back to the original position after quick splitter moves. The solution for me was to call CancelDrag in the splitter's PreviewMouseUp event handler.

Caveat

This may or may not help others, as I am working with a heavily modified derived class with additional functionality (including managing my own moves), and I have no idea if it will help (or work at all) in a simple scenario.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜