Skip to content

Commit 854065d

Browse files
committed
Create TimePickerExample
1 parent 4d3fe43 commit 854065d

File tree

6 files changed

+63
-0
lines changed

6 files changed

+63
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<UserControl
2+
x:Class="WPFDevelopers.Samples.ExampleViews.TimePickerExample"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:controls="clr-namespace:WPFDevelopers.Samples.Controls"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:local="clr-namespace:WPFDevelopers.Samples.ExampleViews"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
10+
d:DesignHeight="450"
11+
d:DesignWidth="800"
12+
mc:Ignorable="d">
13+
<controls:CodeViewer>
14+
<UniformGrid>
15+
<wd:TimePicker
16+
Width="200"
17+
VerticalAlignment="Center"
18+
wd:ElementHelper.Watermark="请选择任意时间" />
19+
<wd:TimePicker
20+
Width="200"
21+
VerticalAlignment="Center"
22+
IsCurrentTime="True"/>
23+
<wd:TimePicker
24+
Width="200"
25+
VerticalAlignment="Center"
26+
SelectedTime="2023-05-06 23:59:59" />
27+
</UniformGrid>
28+
<controls:CodeViewer.SourceCodes>
29+
<controls:SourceCodeModel CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/TimePickerExample.xaml" CodeType="Xaml" />
30+
<controls:SourceCodeModel CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/TimePickerExample.xaml.cs" CodeType="CSharp" />
31+
</controls:CodeViewer.SourceCodes>
32+
</controls:CodeViewer>
33+
</UserControl>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Windows.Controls;
2+
3+
namespace WPFDevelopers.Samples.ExampleViews
4+
{
5+
/// <summary>
6+
/// TimePickerExample.xaml 的交互逻辑
7+
/// </summary>
8+
public partial class TimePickerExample : UserControl
9+
{
10+
public TimePickerExample()
11+
{
12+
InitializeComponent();
13+
}
14+
}
15+
}

src/WPFDevelopers.Samples.Shared/Helpers/MenuEnum.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public enum MenuEnum
7878
NumericBox,
7979
ColorPicker,
8080
IPEditBox,
81+
TimePicker,
8182
VirtualizingWrapPanel,
8283
AcrylicBlur,
8384
TaskbarInfo

src/WPFDevelopers.Samples.Shared/ViewModels/MainVM.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ void MenuItemSelection(string _menuName)
312312
case MenuEnum.IPEditBox:
313313
ControlPanel = new IPEditBoxExample();
314314
break;
315+
case MenuEnum.TimePicker:
316+
ControlPanel = new TimePickerExample();
317+
break;
315318
case MenuEnum.VirtualizingWrapPanel:
316319
ControlPanel = new VirtualizingWrapPanel();
317320
new VirtualizingWrapPanelExample().MaskShowDialog();

src/WPFDevelopers.Samples.Shared/WPFDevelopers.Samples.Shared.projitems

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,9 @@
394394
<SubType>Code</SubType>
395395
<DependentUpon>ThermometerExample.xaml</DependentUpon>
396396
</Compile>
397+
<Compile Include="$(MSBuildThisFileDirectory)ExampleViews\TimePickerExample.xaml.cs">
398+
<DependentUpon>TimePickerExample.xaml</DependentUpon>
399+
</Compile>
397400
<Compile Include="$(MSBuildThisFileDirectory)ExampleViews\TransformThumbExample.xaml.cs">
398401
<SubType>Code</SubType>
399402
<DependentUpon>TransformThumbExample.xaml</DependentUpon>
@@ -868,6 +871,10 @@
868871
<Generator>MSBuild:Compile</Generator>
869872
<SubType>Designer</SubType>
870873
</Page>
874+
<Page Include="$(MSBuildThisFileDirectory)ExampleViews\TimePickerExample.xaml">
875+
<Generator>MSBuild:Compile</Generator>
876+
<SubType>Designer</SubType>
877+
</Page>
871878
<Page Include="$(MSBuildThisFileDirectory)ExampleViews\TransformThumbExample.xaml">
872879
<Generator>MSBuild:Compile</Generator>
873880
<SubType>Designer</SubType>

src/WPFDevelopers.SamplesCode/WPFDevelopers.SamplesCode.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
<Resource Include="..\WPFDevelopers.Samples.Shared\ExampleViews\ColorPickerExample.xaml.cs" Link="ExampleViews\ColorPickerExample.xaml.cs" DependentUpon="ColorPickerExample.xaml" />
142142
<Resource Include="..\WPFDevelopers.Samples.Shared\ExampleViews\IPEditBoxExample.xaml.cs" Link="ExampleViews\IPEditBoxExample.xaml.cs" DependentUpon="IPEditBoxExample.xaml" />
143143
<Resource Include="..\WPFDevelopers.Samples.Shared\ExampleViews\IPEditBoxExample.xaml.cs" Link="ExampleViews\TransformThumbExample.xaml.cs" DependentUpon="TransformThumbExample.xaml" />
144+
<Resource Include="..\WPFDevelopers.Samples.Shared\ExampleViews\TimePickerExample.xaml.cs" Link="ExampleViews\TimePickerExample.xaml.cs" DependentUpon="TimePickerExample.xaml" />
144145
</ItemGroup>
145146
<ItemGroup>
146147
<Resource Include="..\WPFDevelopers.Samples.Shared\ExampleViews\AboutWindow.xaml">
@@ -476,5 +477,8 @@
476477
<Resource Include="..\WPFDevelopers.Samples.Shared\ExampleViews\IPEditBoxExample.xaml">
477478
<Link>ExampleViews\IPEditBoxExample.xaml</Link>
478479
</Resource>
480+
<Resource Include="..\WPFDevelopers.Samples.Shared\ExampleViews\TimePickerExample.xaml">
481+
<Link>ExampleViews\TimePickerExample.xaml</Link>
482+
</Resource>
479483
</ItemGroup>
480484
</Project>

0 commit comments

Comments
 (0)