我有一个 ListView 显示使用 MVVM 和自定义模板的帐户列表并且工作正常现在单击帐户名称,我们需要执行一个需要当前帐户对象的自定义操作
有没有办法将 Label.Tag 属性设置为 Acct 对象?
xaml def 低于 env 是 vs2010 .net 4.0 c#
<ListView Name="lv1" Grid.Column="1" Grid.Row="4"
ItemsSource="{Binding AccountsList}"
Background="Transparent" BorderThickness="0">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="/asm1;component/Images/Icons/pdf1.png" Width="12" Height="12" />
<Label Content="{Binding Name}" Margin="0,0,25,0"
ContextMenu="{x:Null}" Name="lblacctItem"
MouseDoubleClick="lbl_MouseDoubleClick" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Background="Transparent"
Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}"
ItemWidth="{Binding (ListView.View).ItemWidth, RelativeSource={RelativeSource AncestorType=ListView}}"
MinWidth="{Binding ItemWidth, RelativeSource={RelativeSource Self}}"
ItemHeight="{Binding (ListView.View).ItemHeight, RelativeSource={RelativeSource AncestorType=ListView}}" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>