Search Results

Search found 1 results on 1 pages for 'uriya'.

Page 1/1 | 1 

  • Finding the TextBlock that is part of the default control template ComboBox generated through code.

    - by uriya
    I'm trying to find the TextBlock that is inside the control template of a comboBox. using VisualTreeHelpar.GetChildrenCount is working only if the comboBox is declared in XAML.In that case GetChildrenCount returns 1 and a recursive search is possible. However, if I declare the combo as a member of the Window class using code, allocated and setting it to its place, the function GetChildrenCount return 0. When I run snoop in this scenario It shows the combo children hierarchy. I want to be able to search the comboBox just as snoop does. Any help would be appreciated. code: ComboBox mCombo = null; private void Windows_Loaded(object sender, RoutedEventArgs e) { mCombo = new ComboBox; mGrid.Children.Add(mCombo); Grid.SetRow(mCombo,0); int count = VisualTreeHelpar.GetChildrenCount(mCombo); }

    Read the article

1