如何在mvvm中获取textblock的值

时间:2020-03-22 17:44:11

标签: wpf mvvm

我有一个ItemControl,其中包含元素列表。 我需要使用MVVM获取TextBlock的值。

这是我的XAML代码:

<ItemsControl ItemsSource="{Binding IhmtEcosystemFilterList}">
   <ItemsControl.ItemTemplate>
       <DataTemplate>
           <Button  Margin="5" Height="80" Background="LightBlue" BorderBrush="Black" Command="{Binding CmdStatistiqueEcoSystem, ElementName={Binding Name}}">
               <StackPanel Width="150">
                   <TextBlock Text="{Binding Name}" Foreground="White" FontSize="17" Name="valueTxtBloc"  />
                   <Image x:Name="imgAvion" Source="/Resources/Images/avion.png"  Width="35"></Image>
               </StackPanel>
           </Button>
       </DataTemplate>
   </ItemsControl.ItemTemplate>

0 个答案:

没有答案