当我移动一个“主”窗口时,我想移动两个或更多的粘性窗口
我想要做这样的事情
private void MainWindow_PreviewMouseMove(object sender,MouseEventArgs e) { if (e.LeftButton == MouseButtonState.pressed) { this.DragMove(); foreach (var window in App.Current.Windows.OfType<Window>()) { window.Move(); // move it } } }
我想用这个解决scheme来捕捉窗口
用于WPF的捕捉/粘滞/磁性窗口http://programminghacks.net/2009/10/19/download-snapping-sticky-magnetic-windows-for-wpf/
定义不同types的二维dynamic数组
为什么Console.Out.WriteLine存在?
如何有效地检查,如果一个path是C#中的另一个path的孩子?
计划的控制台应用程序与Windows服务? 什么时候适用每个?
在Linux上部署ASP.NET MVC:最佳实践,工具和惊喜
但是我怎样才能移动它?
编辑
在Gustavo Cavalcanti的回复之后,我提了几个想法。 这是我的问题的粗略解决scheme。
using System.Windows; using System.Windows.Data; namespace DragMoveForms { /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { public Window1() { this.InitializeComponent(); } public Window1(Window mainWindow) : this() { var b = new Binding("Left"); b.Converter = new MoveLeftValueConverter(); b.ConverterParameter = mainWindow; b.Mode = BindingMode.TwoWay; b.source = mainWindow; BindingOperations.SetBinding(this,LeftProperty,b); b = new Binding("Top"); b.Converter = new MovetopValueConverter(); b.ConverterParameter = mainWindow; b.Mode = BindingMode.TwoWay; b.source = mainWindow; BindingOperations.SetBinding(this,TopProperty,b); } } } using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace DragMoveForms { public class MoveLeftValueConverter : IValueConverter { public object Convert(object value,Type targettype,object parameter,CultureInfo culture) { // ok,this is simple,it only demonstrates what happens if (value is double && parameter is Window) { var left = (double)value; var window = (Window)parameter; // here i must check on which side the window sticks on return left + window.ActualWidth; } return 0; } public object ConvertBack(object value,CultureInfo culture) { return DependencyProperty.UnsetValue; } } } using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace DragMoveForms { public class MovetopValueConverter : IValueConverter { public object Convert(object value,it only demonstrates what happens if (value is double && parameter is Window) { var top = (double)value; var window = (Window)parameter; // here i must check on which side the window sticks on return top; } return 0; } public object ConvertBack(object value,CultureInfo culture) { return DependencyProperty.UnsetValue; } } }
以编程方式通过path打印未知types的文件
如何阅读扫描支票的支票号码和银行汇票号码
如何打包单个文件的Windows EXE下载?
如何使用Mono Develop在Linux上创buildExcel文件
在窗口的左侧和顶部使用数据绑定。 使用转换器来确定基于主窗口的右侧/顶部。 那么只要担心移动主窗口,其他人会相应地移动。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。