DateTimePickerPage.xaml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:sys="clr-namespace:System;assembly=netstandard"
  6. mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
  7. x:Class="ControlCatalog.Pages.DateTimePickerPage">
  8. <StackPanel Orientation="Vertical" Spacing="4" HorizontalAlignment="Stretch">
  9. <TextBlock Classes="h1">DatePicker and TimePicker</TextBlock>
  10. <TextBlock Name="DatePickerDesc" Classes="h2" TextWrapping="Wrap"/>
  11. <TextBlock Name="TimePickerDesc" Classes="h2" TextWrapping="Wrap"/>
  12. <StackPanel Orientation="Vertical"
  13. Margin="16"
  14. HorizontalAlignment="Stretch"
  15. Spacing="16">
  16. <TextBlock FontSize="18">A simple DatePicker with a header</TextBlock>
  17. <StackPanel Orientation="Vertical">
  18. <Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
  19. BorderThickness="1" Padding="15">
  20. <DatePicker Header="Pick a date" />
  21. </Border>
  22. <Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}">
  23. <TextBlock Padding="15">
  24. <TextBlock.Text>
  25. <x:String>
  26. &lt;DatePicker Header="Pick a date" /&gt;
  27. </x:String>
  28. </TextBlock.Text>
  29. </TextBlock>
  30. </Panel>
  31. </StackPanel>
  32. <Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
  33. BorderThickness="1" Padding="15">
  34. <DatePicker Header="Pick a date">
  35. <DataValidationErrors.Error>
  36. <sys:Exception />
  37. </DataValidationErrors.Error>
  38. </DatePicker>
  39. </Border>
  40. <TextBlock FontSize="18">A DatePicker with day formatted and year hidden.</TextBlock>
  41. <StackPanel Orientation="Vertical">
  42. <Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
  43. BorderThickness="1" Padding="15">
  44. <DatePicker x:Name="Control2" DayFormat="d (ddd)"
  45. YearVisible="False" />
  46. </Border>
  47. <Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}">
  48. <TextBlock Padding="15">
  49. <TextBlock.Text>
  50. <x:String>
  51. &lt;DatePicker DayFormat="d (ddd)" YearVisible="False" /&gt;
  52. </x:String>
  53. </TextBlock.Text>
  54. </TextBlock>
  55. </Panel>
  56. </StackPanel>
  57. <Border Background="{DynamicResource SystemControlHighlightBaseLowBrush}" BorderThickness="1" Margin="15" />
  58. <TextBlock FontSize="18">A simple TimePicker.</TextBlock>
  59. <StackPanel Orientation="Vertical">
  60. <Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
  61. BorderThickness="1" Padding="15">
  62. <TimePicker />
  63. </Border>
  64. <Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}">
  65. <TextBlock Padding="15">
  66. <TextBlock.Text>
  67. <x:String>
  68. &lt;TimePicker /&gt;
  69. </x:String>
  70. </TextBlock.Text>
  71. </TextBlock>
  72. </Panel>
  73. </StackPanel>
  74. <Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
  75. BorderThickness="1" Padding="15">
  76. <TimePicker Header="Pick a time">
  77. <DataValidationErrors.Error>
  78. <sys:Exception />
  79. </DataValidationErrors.Error>
  80. </TimePicker>
  81. </Border>
  82. <TextBlock FontSize="18">A TimePicker with a header and minute increments specified.</TextBlock>
  83. <StackPanel Orientation="Vertical">
  84. <Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
  85. BorderThickness="1" Padding="15">
  86. <TimePicker Header="Arrival time" MinuteIncrement="15" />
  87. </Border>
  88. <Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}">
  89. <TextBlock Padding="15">
  90. <TextBlock.Text>
  91. <x:String>
  92. &lt;TimePicker Header="Arrival time" MinuteIncrement="15" /&gt;
  93. </x:String>
  94. </TextBlock.Text>
  95. </TextBlock>
  96. </Panel>
  97. </StackPanel>
  98. <TextBlock FontSize="18">A TimePicker using a 12-hour clock.</TextBlock>
  99. <StackPanel Orientation="Vertical">
  100. <Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
  101. BorderThickness="1" Padding="15">
  102. <TimePicker ClockIdentifier="12HourClock" Header="12 hour clock" />
  103. </Border>
  104. <Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}">
  105. <TextBlock Padding="15">
  106. <TextBlock.Text>
  107. <x:String>
  108. &lt;TimePicker ClockIdentifier="12HourClock" Header="12 hour clock" /&gt;
  109. </x:String>
  110. </TextBlock.Text>
  111. </TextBlock>
  112. </Panel>
  113. </StackPanel>
  114. <TextBlock FontSize="18">A TimePicker using a 24-hour clock.</TextBlock>
  115. <StackPanel Orientation="Vertical">
  116. <Border BorderBrush="{DynamicResource SystemControlHighlightBaseLowBrush}"
  117. BorderThickness="1" Padding="15">
  118. <TimePicker ClockIdentifier="24HourClock" Header="24 hour clock" />
  119. </Border>
  120. <Panel Background="{DynamicResource SystemControlBackgroundBaseLowBrush}">
  121. <TextBlock Padding="15">
  122. <TextBlock.Text>
  123. <x:String>
  124. &lt;TimePicker ClockIdentifier="24HourClock" Header="24 hour clock" /&gt;
  125. </x:String>
  126. </TextBlock.Text>
  127. </TextBlock>
  128. </Panel>
  129. </StackPanel>
  130. </StackPanel>
  131. </StackPanel>
  132. </UserControl>