Hi moondaddy,
The Thumb object doesn't get shown because you have added it in the wrong
collection. In the code you have provided, you're adding it to
visualChildren. However, visualChildren is the parent of myGrid. In this
case, you have to add the Thumb to myGrid.
Also, in the grid, we don't use Arrange to change the position of a
control. We have to use Margin property. Here, I worked out a sample that
works fine on my machine. Hope that helps.
VisualCollectio n visualChildren = new VisualCollectio n(myGrid);
Line myLine;
myLine = new Line();
myLine.Stroke = Brushes.Black;
myLine.StrokeTh ickness = 3;
this.myGrid.Chi ldren.Add(myLin e);
myLine.X1 = 30;
myLine.Y1 = 20;
myLine.X2 = 70;
myLine.Y2 = 40;
Thumb cornerThumb = new Thumb();
cornerThumb.Cur sor = Cursors.SizeNWS E;
cornerThumb.Hei ght = cornerThumb.Wid th = 10;
cornerThumb.Opa city = 0.40;
cornerThumb.Bac kground = new SolidColorBrush (Colors.MediumB lue);
cornerThumb.Hor izontalAlignmen t = HorizontalAlign ment.Left;
cornerThumb.Ver ticalAlignment = VerticalAlignme nt.Top;
cornerThumb.Mar gin = new Thickness(myLin e.X1 - 5, myLine.Y1 -
5, myLine.X1 - 5 + cornerThumb.Wid th, myLine.Y1 - 5 + cornerThumb.Hei ght);
this.myGrid.Chi ldren.Add(corne rThumb);
If anything is unclear, please feel free to let me know.
Kevin Yu
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
(This posting is provided "AS IS", with no warranties, and confers no
rights.)