Inside an itemchemplate element, the binding is initialized by the context of the current element in AllItems.
Update
Outside ItemTemplateyour bindings relate to the DataContext of the page. **
ItemTemplate , .
, ( ):
<ItemsControl x:Name="myList" ItemsSource="{Binding AllItems}" >
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock x:Name="tb1"
Text="{Binding DataContext.Test, ElementName=myList}"/>
<TextBlock x:Name="tb2" Text="{Binding KeyName}"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
tb1 DataContext.
tb2 cann access KeyName - , AllItems IEnumerable of .
, itemtemplate , , , ( ElementName ).
Test , .
, - , , , , .
** , ItemsControls ( )