小编los*_*rik的帖子

从模板绑定到ViewModel的属性

我为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的属性。

我应该使用什么?

wpf xaml binding templates

1
推荐指数
1
解决办法
2535
查看次数

通过查询将计数组合并到单个表中

我有一个这样的表(实际上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)

sql sql-server group-by

1
推荐指数
1
解决办法
715
查看次数

标签 统计

binding ×1

group-by ×1

sql ×1

sql-server ×1

templates ×1

wpf ×1

xaml ×1