1

次のグループ スタイル ヘッダー テンプレートを含むグリッド ビューがあります。

<GroupStyle.HeaderTemplate>
                        <DataTemplate>
                            <Grid Margin="1,0,0,6">
                                <Button
                                    AutomationProperties.Name="Group Title"
                                    Command="{Binding GroupCommand}"
                                    Style="{StaticResource TextPrimaryButtonStyle}"
                                    >
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="{Binding Key}" Margin="3,-7,10,10" Style="{StaticResource GroupHeaderTextStyle}" />
                                        <TextBlock Text="{StaticResource ChevronGlyph}" FontFamily="Segoe UI Symbol" Margin="0,-7,0,10" Style="{StaticResource GroupHeaderTextStyle}"/>
                                    </StackPanel>
                                </Button>
                            </Grid>
                        </DataTemplate>
                    </GroupStyle.HeaderTemplate>

問題は、ボタンをクリックしても GroupCommand が実行されないことです。

ここで何が問題になる可能性がありますか?

4

2 に答える 2

2

この方法を試してください:

private void Button_Tapped_1(object sender, TappedRoutedEventArgs e)
        {
            SampleDataItem item = new SampleDataItem("test", "test!", "subtitle", "", "", "", null);
            SampleDataSource.AddItemToFirstGroup(item);
        }

        private void Button_Tapped_2(object sender, TappedRoutedEventArgs e)
        {
            SampleDataGroup group = new SampleDataGroup("test", "testGroup", "subtitle", "", "");
            group.Items.Add(new SampleDataItem("test", "test!", "subtitle", "", "", "", null));
            SampleDataSource.AddGroup(group);
        }
于 2013-04-30T05:06:22.860 に答える