Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting objects on a WPF canvas?
Message
De
23/02/2009 14:26:20
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Titre:
Selecting objects on a WPF canvas?
Divers
Thread ID:
01383557
Message ID:
01383557
Vues:
111
I have a WPF Canvas with some Ellipse objects on it (displayed as circles). Each circle is from a collection class instance which is actually a custom hole pattern class. Each pattern has a certain number of circles, and each circle then gets added to the canvas using an iteration over the collection using the code below.

So, the canvas is populated with a bunch of circles and each circle belongs to a certain pattern instance. You can see a screenshot here: http://twitpic.com/1f2ci/full

Now I want to add the ability to click on a circle on the canvas, and be able to determine the collection it belongs to, so that I can then do some more work on the selected pattern to which that circle belongs.
public void DrawHoles()   
{   
   // Iterate over each HolePattern in the HolePatterns collection...    
   foreach (HolePattern HolePattern in HolePatterns)   
    {   
        // Now iterate over each Hole in the HoleList of the current HolePattern...   
        foreach (Hole Hole in HolePattern.HoleList)   
        {   
            Hole.CanvasX = SketchX0 + (Hole.AbsX * _ZoomScale);   
            Hole.CanvasY = SketchY0 - (Hole.AbsY * _ZoomScale);   
            canvas1.Children.Add(Hole.HoleEntity);   
        }   
    }   
}  
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform