How to access a named control inside a XAML DataTemplate (using XAML) RRS feed

  • Question

  • Hello All,

    I have a situation where I need to access a data template control from  parent control. following is the code snipped.

    Look at the Bold Sections.

     <TabControl Margin="5,0,0,0" 
                      ItemsSource="{Binding Workspaces}" 
                      ItemTemplateSelector="{StaticResource SettingsTemplateSelector}" 
                        <Binding ElementName="CloseButton"/>
                <StackPanel Orientation="Horizontal">
                  <TextBlock Text="{Binding Header}"></TextBlock>
                  <Button Name="CloseButton" Content="X" Margin="5,0,0,0"></Button>

     In the above markup,  I need to bind the Button named CloseButton to TabcontrolService's TabCloseButton property which is a dependency property. I need to do it through XAML only, no code behind code.

    Please Help me somebody, waiting for your valuable solutions.


    Debasish Das Software Developer. gloStream Inc.

    Monday, July 22, 2013 12:21 PM


All replies