VisualTreeHelper.GetChildrenCount return 0?

前端 未结 2 1852
闹比i
闹比i 2021-02-07 17:45

I\'m using VisualTreeHelper.GetChildrenCount() to find child controls, but it always return 0.

Here is my code



        
2条回答
  •  情深已故
    2021-02-07 18:05

    If your using Caliburn.Micro this will help you. For your Viewmodel the base Class should be Screen then only VisualTreeHelper.GetChildrenCount() give no.of childs.(because Screen will Activate all childs

    or otherwise (FrameworkElement)YourParent).ApplyTemplate() method

提交回复
热议问题