Silverlight Popup sample

4 02 2011

Silverlight popup samples:
Check here: http://www.silverlightnext.com/2011/01/silverlight-popup-sample.html

Advertisements




Tips – Find control in custom DataGrid header style

5 04 2010

Suppose, you have DataGrid column header style like below:

    <Style
        TargetType="dataprimitives:DataGridColumnHeader">
        <Setter
            Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel>
                        <ComboBox
                            x:Name="myComboBox"
                            Width="70"></ComboBox>
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Now you want to access myComboBox control.

You can use MyVisualTreeHelper class (described here).

You can access the control like below:

    var myCbo = MyVisualTreeHelper
                .SearchFrameworkElement(myDataGrid, "myComboBox");