0

このように 4 つの ToggleSwitch を定義しました (例からコピー)。DataTemplate を使用する必要がありますか?? ここで、TimePicker の時間値を変更したいと思います。time_picker にアクセスしてコンテンツを変更するにはどうすればよいですか? どうもありがとう!

                <toolkit:ToggleSwitch Name="sleep_mode" Grid.Row="1" Header="{Binding Path=LocalizedResources.Sleep_Mode, Source={StaticResource LocalizedStrings}}" Checked="fetch_sleepmode_Checked" Unchecked="fetch_sleepmode_UnChecked" Click="OnClicked">
                <toolkit:ToggleSwitch.HeaderTemplate>
                    <DataTemplate>
                        <ContentControl FontSize="{StaticResource PhoneFontSizeLarge}" Foreground="{StaticResource PhoneForegroundBrush}" Content="{Binding}"/>
                    </DataTemplate>
                </toolkit:ToggleSwitch.HeaderTemplate>
                <toolkit:ToggleSwitch.ContentTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Path=LocalizedResources.Status, Source={StaticResource LocalizedStrings}}" FontSize="{StaticResource PhoneFontSizeSmall}"/>
                                <ContentControl HorizontalAlignment="Left" FontSize="{StaticResource PhoneFontSizeSmall}" Content="{Binding}"/>
                            </StackPanel>
                            <TextBlock Text="{Binding Path=LocalizedResources.SleepMode, Source={StaticResource LocalizedStrings}}" TextWrapping="Wrap" FontSize="{StaticResource PhoneFontSizeSmall}" Foreground="{StaticResource PhoneSubtleBrush}" Width="360"/>
                            **<toolkit:TimePicker x:Name="time_picker"  ValueChanged="TimePicker_ValueChanged"/>**
                        </StackPanel>
                    </DataTemplate>
                </toolkit:ToggleSwitch.ContentTemplate>
            </toolkit:ToggleSwitch>
4

1 に答える 1