Draw rectangle when mouse dragged using MVVM in WPF

倾然丶 夕夏残阳落幕 提交于 2019-11-29 07:15:08

A very neat way of implementing resizing can be found in this article / project. If you use the DesignerItemStyle implemented there, you can add binding support like so :

<Rectangle Style="{StaticResource DesignerItemStyle}"
           Canvas.Left="{Binding Path=Leftoffset, Mode=TwoWay}"
           Canvas.Top="{Binding Path=Topoffset, Mode=TwoWay}"
           Width="{Binding Path=Width, Mode=TwoWay}"
           Height="{Binding Path=Height, Mode=TwoWay}">    

That leaves the drag to resize stuff in pure XAML and uses standard WPF means to get the values to the underlying ViewModels.

Just Refer the link given below Visit Code project!

http://www.codeproject.com/Articles/148503/Simple-Drag-Selection-in-WPF?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!