c# - Making graphic object selected -


hi want make graphic object "selected" after click on them.

i tryied make selected line:

else if (e.originalsource line)         {             linefocus = true;             mojalinia = (line)e.originalsource;              rectangle rect_1 = new rectangle             {                 stroke = brushes.black,                 strokethickness = 1,                 fill = new solidcolorbrush(color.fromrgb(255, 255, 255))             };             rect_1.width = 6;             rect_1.height = 6;              canvas.setleft(rect_1, mojalinia.x1);             canvas.settop(rect_1, mojalinia.y1);             canvas.children.add(rect_1);             rectangle rect_2 = new rectangle             {                 stroke = brushes.black,                 strokethickness = 1,                 fill = new solidcolorbrush(color.fromrgb(255, 255, 255))             };             rect_2.width = 6;             rect_2.height = 6;              canvas.setleft(rect_2, mojalinia.x2);             canvas.settop(rect_2, mojalinia.y2);             canvas.children.add(rect_2);         } 

its bit stupid, , hard make white rectangle distance line. there way without tons of if() ?

im using vs2012, wpf/c# .

you can use adorners show shape "selected", way can make "selected" state visual hint in xaml.

and can use attached property "add" isselected property (boolean example) object , toggle value each time there click event rised.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -