I have a WPF window, with multiple ListBox controls on it, all sharing the same style that I've simplified here:
<Style x:Key="listBox" TargetType="{x:Type ListBox}">
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<Border BorderBrush="Black">
<StackPanel Orientation="Horizontal" >
<TextBlock Text="{Binding Path=name}" />
<TextBlock Text="{Binding Path=text}" />
<TextBlock Text="id:" />
<TextBlock x:Name="_idTextBlock" Text="{Binding Path=id}" />
<Button Name="btnGet" CommandParameter="{Binding Path=id}" />
</StackPanel>
</Border>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
And here is an example of one of the ListBox controls using that style:
<ListBox x:Name="lbCampaigns" Button.Click="lbCampaigns_Click" ItemsSource="{Binding}" Style="{StaticResource listBox}" />
How can I set the Content of the Button control (btnGet) from within the parent ListBox?
I know what text I want the button to display at design time for each ListBox on the Window. (i.e. I don't need to bind it to the ListBox ItemsSource). I see that I can define the child control's events (see the Button.Click definition), but it doesn't appear that I can set the child control's properties in the same manner.
Any ideas? Thanks!