Skip to main content
Home Forums Silverlight Programming Programming with .NET - General How to move datagrid anywhere on the screen only not outside the screen
2 replies. Latest Post by mahendra.gurav on November 10, 2008.
(0)
mahendra...
Member
136 points
158 Posts
11-07-2008 6:12 AM |
Hello,
By using the link http://dotnetcurry.com/ShowArticle.aspx?ID=198
I created application to move DataGrid on screen successfully.But i want to move it only on screen. Now it can move outside the screen and invisible to user. So how to restrict this move on screen only. I write code for that, like measure screen width at runtime and by chking condition restrict it.
But once it stop to move then create problem to move again. Please give solution for that
Thanks, Mahendra
prujohn
Contributor
3567 points
703 Posts
11-07-2008 1:58 PM |
I used a slightly different technique to solve the problem you are describing. Instead of trying to control the location of the element(in your case a datagrid) while it is being dragged, I instead inspect the position of the element relative to the screen after the MouseLeftButtonUp event fires, then relocate it back on screen if it is out of bounds.
That is perhaps one way to approach it.
11-10-2008 5:50 AM |
Hi John,
I used exacly the same technique and resolver this problem.
Thanks for reply,
Mahendra