简体   繁体   中英

Select all Childeren in inkcanvas control

如何选择所有笔画旁边的所有孩子“我可以选择所有笔画”,我想选择所有孩子,例如我对所有笔画使用Inkcanvas.Select(strokes)文本框和图像。

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);
            }
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM