0
이렇게 ToggleSwitch를 4 개 정의했습니다 (예제에서 복사). DataTemplate을 사용해야합니까 ?? 이제 TimePicker에서 시간 값을 변경하고 싶습니다. time_picker에 액세스하고 콘텐츠를 변경하려면 어떻게해야합니까? 고마워요! 당신도 ToggleSwitch
에 대한 ContentTemplate
를 설정 귀찮게 왜 경우Windows Phone : C# 코드에서 TimePicker의 시간을 변경하는 방법
<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>
그래, 처음에는이 예제에서 ContentTemplate이 필요한 이유가 의심 스럽습니다. 나는 제거하려고했지만 잘 작동하지 않았습니다. 그러나 지금 나는 그것을 다시했고 잘 작동하지 않습니다. 감사! 아, 왜 timePicker를 ToggleSwitch에 넣는가하는 이유는 timepicker를 토글 스위치의 텍스트와 정렬하고 싶기 때문입니다. 조금 어리 석다. 그러나 나를 위해 그것이 일한다 :) – thsieh