Monthly Archive for June, 2011

Enumerating Child Windows in Silverlight

Today I’d like to give you a short example how to enumerate all child windows in a Silverlight application:

1
2
3
4
5
6
7
8
9
10
11
12
13
void EnumChildWindows(Visual visualParent)
{
    for (int i = 0; i < VisualTreeHelper.GetChildrenCount(visualParent); i++)
    {
        Visual visual = (Visual)VisualTreeHelper.GetChild(visualParent, i);
        EnumChildWindows(visual);
 
        if (visual is Button)
        {
            // do something
        }
    }
}

In the code snippet above, the child windows are collected recursively. Since EnumChildWindows accepts a visualParent of Type Visual, one can start using the MainWindow object, e.g. obtained via reflection. This technique even finds child windows (buttons, text boxes, etc.) not defined in a XAML file.

T-Mobile MultiSIM SMS-Empfang

Dieser Post ist eigentlich nur eine Gedankenstütze für mich: :-)

  • Wie aktiviert man den SMS-Empfang bei einer MultiSIM von T-Mobile?
    Lösung: *222#
  • Wie fragt man den Status ab?
    Lösung: *221#

Quelle: http://www.t-mobile.de/T-D1/cds/td1_cds_popup/1,1132,108350-0-,00.html