Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Problem Modifying Adorners

 
 
Old 11-07-2007   #1 (permalink)
SachitHippie


 
 

Problem Modifying Adorners


I'm trying to implement Adorners for some visual objects (Selecting multiple
Controls on a canvas at once and moving them using Dragging ).

the best resource i've found is Henry Hahn's example on his blog:

http://blogs.msdn.com/henryh/archive...19/440854.aspx

i tried to select multiple items by clicking on them holding the control Key
and setting the Selected bool to false

if (Keyboard.Modifiers == ModifierKeys.Control)
{
selected = false;
}
if (e.Source != myCanvas)
{
_isDown = true;
_startPoint = e.GetPosition(myCanvas);

selectedElement = e.Source as UIElement;

_originalLeft = Canvas.GetLeft(selectedElement);
_originalTop = Canvas.GetTop(selectedElement);

aLayer = AdornerLayer.GetAdornerLayer(selectedElement);
aLayer.Add(new ResizingAdorner(selectedElement));
selected = true;
SelectCount ++; //SelectCount is count of multiple
// controls selected
e.Handled = true;
}

Worked fine till here , but the build stumbles when try to release all the
controls selected by Adorners :

if (selected) // if a control is selected using adorner
{
selected = false;
if (selectedElement != null)
{
for(int i=0;i< SelectCount;i++) //SelectCount is count of
multiple
// controls
selected
{
// Remove the adorner from the selected element
aLayer.Remove(aLayer.GetAdorners(selectedElement)[i]);
}
selectedElement = null;
}
}

This line--> aLayer.Remove(aLayer.GetAdorners(selectedElement)[i]); is
always throwing array out of index exception, am i trying the right way to do
it ?

Also can the selected controls can be moved around as we do it in the
Desktop ?


Please Help !!!!
thanks all!

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
modifying customsettings.ini Vista installation & setup
Problem with Vista deleting, modifying files on an XP drive Vista General
Modifying the Welcome Center Vista General
Modifying a post PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46