.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Move all children on canvas or preferrably move the entire canvas

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :WPF


I´m working on a small app that parses the gpx file from the GPS. It will animate how me and my dog moves when we go hunting. I want to zoom in so that I can analyse how the dog is working and therefore need the graph to scroll and keep my position centered.

Yesterday I used a Canvas and plotted my points as black rectangles and the dog as red rectangles. Then used the SetLeft and SetTop to scroll the Canvas. I then added a polyline connecting the dogs points but didnt find StLeft and SetTop for the polyline. Played around with RenderTransform but never got it working.

1. My question is is canvas suitable for this?

2. Is there a way to move the entire canvas and all its children in one command?

3. Is there a generic way that can be used to move all UIElements.

By move I mean move relative an element relative to its current position, for example 2 pixels left and 5 pixels up.



Trying to learn

View Complete Post

More Related Resource Links

Drag-move canvas and its children


With VS2008, I have created a Canvas in a ScrollViewer, in which I place an Image which I overlay with Buttons and StackPanels. This far, everything works as I'd want to, but my next challenge is to implement a drag-move behavior where the user can click on the Image and drag it in every direction. I figured out how I should move just the Image, but the problem is that the Buttons and StackPanels stay in place, where I really want them to be moved with Image as well. Trying to convert the drag-the-Image-method to a sort of drag-the-Canvas one did not work out for me.

So my layout is structured like this:


Zooming in/out on canvas: how to leave some children unscaled?


I'm working with Visual Studio 2008 and I have created a window with a Canvas in a ScrollViewer. On the canvas, I've placed an image and the code I've written places buttons on the canvas at certain locations. So far, so good, but I'm trying to implement a zooming method which scales the canvas and the image, but leaves the buttons intact in terms of size and content -- however, their location should scale together with the image and the canvas.
What I have thusfar is this:

private void zoomIn(Object sender, MouseButtonEventArgs e)
  mapCanvas.Width *= ZoomFactor;
  mapCanvas.Height *= ZoomFactor;
  Zoom *= ZoomFactor;
  TransformGroup transform = new TransformGroup();
  transform.Children.Add(new ScaleTransform(Zoom, Zoom));
  transform.Children.Add(new TranslateTransform(0, 0));
  mapCanvas.RenderTransform = transform;

This, together with an analogue zoomOut method, works like a charm, but the buttons are scaled as well, obviously because RenderTransform is applied to every child of the canvas as well.

My question is: how can I leave the buttons unscaled?

Get location of Children of a Canvas


I'm having some trouble determining the location of UIElements on a Canvas, StackPanels to be exact. I want to be able to compare their location to a given location, but I don't see how I should get their location.

Does anybody have an idea?

Editor's Note: A Look Back As We Move Forward


Here's a look at a year's worth of coverage and changes at MSDN Magazine in response to reader requests.

Howard Dierking

MSDN Magazine January 2009

GridView: Move Over DataGrid, There's a New Grid in Town!


When incorporating the ASP.NET DataGrid control into your Web apps, common operations such as paging, sorting, editing, and deleting data require more effort than you might like to expend. But all that is about to change. The GridView control--the successor to the DataGrid-- extends the DataGrid's functionality it in a number of ways. First, it fully supports data source components and can automatically handle data operations, such as paging, sorting, and editing, as long as its bound data source object supports these capabilities. In addition, the GridView control offers some functional improvements over the DataGrid. Here DataGrid expert Dino Esposito introduces the GridView and explains all its long-awaited features.

Dino Esposito

MSDN Magazine August 2004

C++ -> C#: What You Need to Know to Move from C++ to C#


C# builds on the syntax and semantics of C++, allowing C programmers to take advantage of .NET and the common language runtime. While the transition from C++ to C# should be a smooth one, there are a few things to watch out for including changes to new, structs, constructors, and destructors. This article explores the language features that are new to C# such as garbage collection, properties, foreach loops, and interfaces. Following a discussion of interfaces, there's a discussion of properties, arrays, and the base class libraries. The article concludes with an exploration of asynchronous I/O, attributes and reflection, type discovery, and dynamic invocation.

Jesse Liberty

MSDN Magazine July 2001

'Meter number is not registered ' error FedEx ship web service move to production



I want to integrate FedEx ship web service in my website. It works fine for local but for production it gives error. I changed test credentials by production credentials. also changed test url "https://gatewaybeta.fedex.com:443/webservices" by production url "https://gateway.fedex.com:443/webservices" But I am getting error that meter number is not registered. Please advice.

Unable to move Wiki pages with Bracketed ([[, ]]) Links


I'm using Microsoft Office Sharepoint Server 2007 (pre-SP1) to host a Wiki, and it's been a learning process as I've been going along.  In this process, I keep finding better places to keep Wiki Pages and Wiki Libraries, so I move things around to find the best fit.  I've run into a strange problem while moving my collection of ~100 Wiki pages, and I'm curious to see if others have it to.  The problem is, I cannot move or copy Wiki Pages that contain links to other Wiki pages using the bracket method (of writing a link as [[other page]]).

Here's how I reach the problem:

-Create 2 Wiki Pages Libraries,  I called mine Wiki PagesA and Wiki PagesB
-I go into my Wiki PagesA library and create a new Wiki page.
-I call it "linktohome" and enter only a single line in the body, "[[home]]"
-I can open it up and it works just fine and the link redirects me to the Home page in the local Wiki PagesA library so it's all good.
-Next in my main Site Collection that's hosting these libraries, I'll pull down Site Actions and go into Manage Content and Structure.
-I can browse into Wiki PagesA and the linktohome document appears
-But, when I try to copy (or move) linktohome to Wiki PagesB library I get an error that says:

Unable to copy/move wiki pages with links to other wiki pages

When I try to copy or move wiki pages from one 'Wiki library A' to 'Wiki library B' through 'content and structure', I get an error for the pages which contain links to other wiki pages, does sameone has a clue how to fix this:

<error><message>Het item bestaat niet. Mogelijk is het door een andere gebruiker verwijderd.</message><full>Microsoft.SharePoint.SPException: Het item bestaat niet. Mogelijk is het door een andere gebruiker verwijderd. ---&gt; Microsoft.SharePoint.SPException: Het item bestaat niet. Mogelijk is het door een andere gebruiker verwijderd. at Microsoft.SharePoint.SPListItem.EnsureItemIsValid() at Microsoft.SharePoint.SPListItem.PrepareItemForUpdate(Guid newGuidOnAdd, Boolean bMigration, Boolean&amp; bAdd, Boolean&amp; bPublish, Object&amp; objAttachmentNames, Object&amp; objAttachmentContents, Int32&amp; parentFolderId) at Microsoft.SharePoint.Deployment.ListItemSerializer.AddOrUpdateDoclibItem(SerializationInfoHelper infoHelper, SPListItem&amp; listItem, SPWeb web, Guid newId, String&amp; listItemServerRelativeUrl, Boolean bIsPublish, Boolean exists, StreamingContext context, ISurrogateSelector selector, ImportObjectManager objectManager) at Microsoft.SharePoint.Deployment.ListItemSerializer.SetObjectData(Object obj, SerializationInfo info, StreamingContext context, ISurr

Can't start crawl becasue of index move operation


Hi there,

I can't start crawl task. The log says that "Deleted by the gatherer (The start address or content source that contained this item was deleted and hence this item was deleted.)" But I did not change the path of content sources and When I trie to start crawling job it says "Crawling might be paused because a backup or an index move operation is in progress. Are you sure you want to resume this crawl?"

What is index move operation? What should I do? I'll really appreciate the solution greatly. Thanks in advance.



Invalid URL"" after copy or move a document.



We have an website that have 3 libraries. The "first Library" is used only to edit documents and it's called "my documents". When a user finish of edit your documents here, they start a workflow that will check fields in the document and move the document for the second library (using Sharepoint Designer Workflow - without custom actions).
In "second library" we have a big workflow. This WF has some steps for approve, collect feedback, generate sub-tasks and others things related for the document. This WF use many custom actions in (Sharepoint Designer).
When this WF arrives to the end, the document is moved to "third library", that is a official repository of documents in the enterprise.
The entire cycle works fine. But when someone creates a internal copy of the document in the "first library" to begin again the flow, we receive a Invalid Url error. It occurs when any update operations is executed over the document item, the value is conserved but the error is displayed. After it, we can not execute other workflows over the item.
If we save the document in local disk, delete the library item, and then upload it again, the problem is solved.

Some one have an idea about why and how solve it?  We are using WSS 3.0.

The following is an error registred in log file when you d

How to use arrow keys to move from textbox to textbox in VB ASP.NET


  I am totally new at this.  For my example I have TextBox1, TextBox2, TextBox3, TextBox4.  They are situated right to left top TextBox1 TextBox2 and bottom TextBox3 TextBox4.  You are currently sitting on TextBox1.  Question: is there a way to use the arrow keys to move between these four textboxes?  If so, could you either point me to how to code it or give me the code to code it.  So in my example pressing the arrow down key would move you from TextBox1 to TextBox3.  Pressing the arrow right key would move you from TextBox1 to TextBox2. So on and so forth.

  Thank you for your time and consideration.

Trying to move FK links from list as columns to my navigation area.



I'm using vs2010, EF. I have a left column simular to a navigation area and I'm trying to figure out a way to display the FK links that appear at the end of a list as columns, in my navigation area.  One thought was to place a duplicate table in the navigation area and hide all the columns except for the FK links. Is there an easier way to accomplish this.

Thanks, Jeff


lable move

i want to move lable right to left, up to down, down to up. so please help me. thanks in advance .          private void Form1_Load(object sender, EventArgs e)         {             label1.Left = 1200;             timer1.Enabled = true;         }         private void timer1_Tick(object sender, EventArgs e)         {             label1.Left = label1.Left - 10;             if (label1.Left == 10)             {                 label1.Left = 1300;             }         }

lable move to up & down and down & up

        private void Form1_Load(object sender, EventArgs e)         {             label1.Left = 1200;             timer1.Enabled = true;         }         private void timer1_Tick(object sender, EventArgs e)         {             label1.Top = label1.Top + 10;             if (label1.Top == 900)             {                 label1.Top = 10;             }         }

lable move

i want to move lable right to left, up to down, down to up. so please help me. thanks in advance .          private void Form1_Load(object sender, EventArgs e)         {             label1.Left = 1200;             timer1.Enabled = true;         }         private void timer1_Tick(object sender, EventArgs e)         {             label1.Left = label1.Left - 10;             if (label1.Left == 10)             {                 label1.Left = 1300;             }         }
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend