0

以下に示すように、App.xaml ページにスタイルがあります。

<Style x:Key="ListBoxMore" TargetType="ListBox">
    <Setter Property="Background" Value="Transparent"/>
    <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Visible"/>
    <Setter Property="BorderThickness" Value="0"/>
    <Setter Property="BorderBrush" Value="Transparent"/>
    <Setter Property="Padding" Value="0"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="ListBox">
                <ScrollViewer x:Name="ScrollViewer" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" Padding="{TemplateBinding Padding}">
                     <StackPanel>
                        <ItemsPresenter/>
                        <Button Content="Load More..." Click="btnLoadMore_Click" Name="btnLoadMore"  Visibility="Visible" Background="White" Foreground="Black"></Button>
                     </StackPanel>
                </ScrollViewer>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

このスタイルを 4 つの異なるページで使用しています。これらのページの [さらに読み込む] ボタンのクリック イベントを取得する必要があります。Windows Phone アプリケーションでこれを取得するにはどうすればよいですか?

4

1 に答える 1

0

できません。

代わりにCommand、ViewModel にバインドできる を使用してみてください。

別の方法として、スタイルを変更したリストボックスをカスタム コントロールに変更すると、そこに一元化されたイベント ハンドラを配置できます。

于 2012-05-16T08:20:15.987 に答える