Select all Childeren in inkcanvas control
how can I select all children 开发者_JAVA百科beside all strokes " I can select all strokes " and I want to select all children like textboxes and images I used Inkcanvas.Select(strokes)
for all strokes how can for children?
you can make it manual by
first :create List<UIElement> elementsToSelect = new List<UIElement>();
second :add every child in it
third : Inkcanvas.select(elementsToSelect)
you can see this link http://msdn.microsoft.com/en-us/library/aa972125%28VS.90%29.aspx
Just add something to the above solution, to add every child into the list, you can use class VisualTreeHelper and function GetChildrenCount and GetChild will be helpful.
From Athena Solution, Software Development in Singapore, http://www.athena-solution.com
List<UIElement> list = new List<UIElement>();
GetAllControl("someCanvas", list);
private void GetAllControl(Canvas c , List<UIElement> list)
{
foreach (Control control in c.Controls)
{
list.Add(control);
if (control.Controls.Count > 0)
GetAllControl(control , list);
}
}
精彩评论