我想访问 WPF 列表框中的所有按钮,这是我的 xaml 代码。
<Grid>
<ScrollViewer x:Name="myScrollViewer" HorizontalScrollBarVisibility="Disabled" MouseDown="myStackPanel_MouseDown" MouseUp="myScrollViewer_MouseMove" VerticalScrollBarVisibility="Hidden" Height="435" BorderBrush="{x:Null}" Width="250" Margin="0,-4,-4,-4" ScrollChanged="scrollerVideoCategory_ScrollChanged">
<StackPanel Orientation="Vertical" Name="StackPanleEmployee" Margin="40,0,0,0" MouseDown="myStackPanel_MouseDown" MouseUp="myScrollViewer_MouseMove" Loaded="StackPanleVideoCategory_Loaded" >
<ListBox x:Name="ListBoxEmployeVideoType" MouseDown="myStackPanel_MouseDown" MouseUp="myScrollViewer_MouseMove" BorderThickness="0,1,0,0" BorderBrush="#E2E2E2">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Width="200" Name="myStackPanel" MouseDown="myStackPanel_MouseDown" MouseUp="myScrollViewer_MouseMove" >
<Button VerticalAlignment="Center" Style="{StaticResource ButtonVideoTabItemDefault}" MouseUp="b_MouseMove" Tag="{Binding Path}" Content="{Binding Name}" Name="btnSubCategory" Click="btnVideoCategorySelection_Click"></Button>
<Separator Background="#E2E2E2" Margin="0"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</ScrollViewer>
</Grid>
有人知道吗?