0

i am binding an ItemsControl to a list, but in item template there is a control which is not binding by current dataSource, i want to bind it with another dataSource.

but i am stuck at accessing that control

my ItemsControl's dataTemplate is--->

<ItemsControl x:Name="ItemRequesterList" IsTabStop="False">
    <ItemsControl.ItemTemplate>
         <DataTemplate x:Name="ItemReqTemplate">
             <StackPanel Margin="10,0,0,0">
                <TextBlock Text="{Binding DisplayName}"></TextBlock>
                <TextBlock Text="requested on"></TextBlock>
                <TextBlock Text="{Binding}"></TextBlock> //<---this control, i 
                                               //    want to bind with another dataSource
             </StackPanel> 
        </DataTemplate>

so how can i access this control, which is lie in each item ?

Ashok Damani
  • 3,896
  • 4
  • 30
  • 48

1 Answers1

0

You could bind the DataContext of that control to some static resource, for example:

<TextBlock Text="{Binding}" DataContext="{StaticResource myOtherContext}"></TextBlock>

See the following:

Silverlight - Setting DataContext in XAML rather than in constructor?

Community
  • 1
  • 1
ColinE
  • 68,894
  • 15
  • 164
  • 232