How to stop the gridspliter when the height or width reach the thresholds
来源:互联网 发布:抢注域名 编辑:程序博客网 时间:2024/05/24 04:28
1. Declare three private fields
private double scrollChange;private double widthThreshold = 100;private double heightThreshold = 100;
2. Add the events for gridspliter
<GridSplitter Grid.Column="1" Margin="0,7,0,0" Name="gridSplitterColumn" Style="{StaticResource gridSplitterStyleForResizeColumns}" DragDelta="gridSplitter_DragDelta" DragCompleted="gridSplitter_DragCompleted" PreviewMouseMove="gridSplitter_PreviewMouseMove" /><GridSplitter Grid.Row="1" Name="gridSplitterForRow" Style="{StaticResource gridSplitterStyleForResizeRows}" HorizontalAlignment="Stretch" Height="7" DragDelta="gridSplitter_DragDelta" DragCompleted="gridSplitter_DragCompleted" PreviewMouseMove="gridSplitter_PreviewMouseMove" />
For how to define the style for gridSplitterStyleForResizeColumns and gridSplitterStyleForResizeRows, please refrence this articlehttp://blog.csdn.net/farawayplace613/article/details/7101587
3. Handle the events gridSplitter_DragDelta, gridSplitter_DragCompleted, gridSplitter_PreviewMouseMove
private void gridSplitter_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) { if (sender.Equals(this.gridSplitterForRow)) { this.scrollChange= e.VerticalChange; } else if (sender.Equals(this.gridSplitterColumn)) { this.scrollChange= e.HorizontalChange; } }
private void gridSplitter_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) { this.scrollChange = 0; }
private void gridSplitter_PreviewMouseMove(object sender, MouseEventArgs e) { if (Math.Abs(this.verticalChange) > 0.1) { if (sender.Equals(this.gridSplitterForRow)) { if (this.someRow.ActualHeight <= heightThreshold && this.scrollChange < 0) { e.Handled = true; } if (this.anotherRow.ActualHeight <= heightThreshold && this.scrollChange > 0) { e.Handled = true; } } else if (sender.Equals(this.gridSplitterColumn)) { if (this.someColumn.ActualWidth <= widthThreshold && this.scrollChange < 0) { e.Handled = true; } if (this.anotherColumn.ActualWidth <= widthThreshold && this.scrollChange > 0) { e.Handled = true; } } } }
- How to stop the gridspliter when the height or width reach the thresholds
- Dynamically changing the linearlayout width or height on Android
- How to set the ListView Rows Height
- PercentRelativeLayout, how to set the height programatically
- how to disable the button when submitting
- How to detect when the client closes the connection?
- How to output the message when using the function 'printf'
- How to detect when the client closes the connection?
- Codechef Reach The Point
- How to pass the value to the function when clicking on the UIButton
- Android Dialog fullScreen&Custom The Width&Height of The Dialog
- Failed to stop the muxer
- How to discard the default animation when AP launched
- AxWindowsMediaPlayer how to make the Tracker disappear when playing
- How to umount when the device is busy
- How to umount when the device is busy
- How to recover when the SAP spool is full
- How to contribute the code or doc to Nifi?
- const int *a, int const *a,int * const a,区别,指针数组,数组指针,声明与定义
- 黑马程序员-在C#中备份和恢复Microsoft SQL Server数据库
- 表单,文本框 + 文本框 = 文本框,输入两个整数,求和
- 【第六章】 AOP 之 6.4 基于@AspectJ的AOP ——跟我学spring3
- 【第六章】 AOP 之 6.5 AspectJ切入点语法详解 ——跟我学spring3
- How to stop the gridspliter when the height or width reach the thresholds
- windows通过git获取 android 源代码
- 没有找到预编译指示信息的头文件"stdafx.h"
- Qualcomm 8*60平台AWB学习笔记一
- 个人观点:苹果对iPad商标事件的解决办法
- Linux下常用函数-进程函数
- bcb 像素操作
- 表值函数
- 分割邮件地址