我为GameViewModel制作了一个视图
我有一些xaml
<UserControl.Resources>
<DataTemplate DataType="{x:Type ViewModels:PlayerViewModel}">
<StackPanel>
<Button
Content="{Binding ?????}"
Command="{Binding WrongAnswerCommand}" />
<TextBlock
Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<ListBox Grid.Row="0"
ItemsSource="{Binding Players}"
IsSynchronizedWithCurrentItem="True">
</ListBox>
</Grid>
Run Code Online (Sandbox Code Playgroud)
因此,这里是一个可观察的玩家集合。
我需要将按钮内容绑定到GameViewModel的属性。
我应该使用什么?
我有一个这样的表(实际上SuccessFlag更复杂)
AccountId SubaccountId SuccessFlag Count
10 1 true 5
10 1 false 1
10 2 true 6
10 2 false 2
21 1 true 7
21 1 false 3
21 2 true 8
21 2 false 4
Run Code Online (Sandbox Code Playgroud)
并需要一个将形成这样一个表的查询
AccountId SubaccountID Failed Total
10 1 1 6
10 2 2 8
21 1 3 10
21 2 4 12
Run Code Online (Sandbox Code Playgroud)