Skip to main content

Microsoft Silverlight

Answered Question How to move datagrid anywhere on the screen only not outside the screenRSS Feed

(0)

mahendra.gurav
mahendra...

Member

Member

136 points

158 Posts

How to move datagrid anywhere on the screen only not outside the screen

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
prujohn

Contributor

Contributor

3567 points

703 Posts

Answered Question

Re: How to move datagrid anywhere on the screen only not outside the screen

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.

mahendra.gurav
mahendra...

Member

Member

136 points

158 Posts

Re: Re: How to move datagrid anywhere on the screen only not outside the screen

Hi John,

     I used exacly the same technique and resolver this problem.

 

Thanks for reply,

Mahendra

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities