Skip to content

Commit

Permalink
Example code for DatePicker
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Nov 3, 2024
1 parent 8161433 commit 9a10296
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void UpdateExampleCode()
<GroupStyle ContainerStyle=""{{StaticResource DataGridRowGroupContainerStyle}}"" HeaderTemplate=""{{StaticResource RowGroupHeaderTemplate}}"" />
</DataGrid.GroupStyle>
</DataGrid>
"
";

#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
mc:Ignorable="d">

<ikw:SimpleStackPanel>
<local:ControlExample HeaderText="DatePicker with a header and placeholder text.">
<local:ControlExample x:Name="Example1" HeaderText="DatePicker with a header and placeholder text.">
<local:ControlExample.Example>
<DatePicker
x:Name="datePicker"
Expand All @@ -21,23 +21,23 @@
</local:ControlExample.Example>
<local:ControlExample.Options>
<ikw:SimpleStackPanel Style="{StaticResource OptionsPanelStyle}">
<TextBox ui:ControlHelper.Header="Header" Text="{Binding ElementName=datePicker, Path=(ui:ControlHelper.Header), UpdateSourceTrigger=PropertyChanged}" />
<TextBox ui:ControlHelper.Header="Header" Text="{Binding ElementName=datePicker, Path=(ui:ControlHelper.Header), UpdateSourceTrigger=PropertyChanged}" TextChanged="TextBox_TextChanged"/>

<TextBox ui:ControlHelper.Header="PlaceholderText" Text="{Binding ElementName=datePicker, Path=(ui:ControlHelper.PlaceholderText), UpdateSourceTrigger=PropertyChanged}" />
<TextBox ui:ControlHelper.Header="PlaceholderText" Text="{Binding ElementName=datePicker, Path=(ui:ControlHelper.PlaceholderText), UpdateSourceTrigger=PropertyChanged}" TextChanged="TextBox_TextChanged"/>

<TextBox ui:ControlHelper.Header="Description" Text="{Binding ElementName=datePicker, Path=(ui:ControlHelper.Description), UpdateSourceTrigger=PropertyChanged}" />
<TextBox ui:ControlHelper.Header="Description" Text="{Binding ElementName=datePicker, Path=(ui:ControlHelper.Description), UpdateSourceTrigger=PropertyChanged}" TextChanged="TextBox_TextChanged"/>

<DatePicker ui:ControlHelper.Header="DisplayDateStart" SelectedDate="{Binding ElementName=datePicker, Path=DisplayDateStart}" />

<DatePicker ui:ControlHelper.Header="DisplayDateEnd" SelectedDate="{Binding ElementName=datePicker, Path=DisplayDateEnd}" />

<CheckBox Content="IsTodayHighlighted" IsChecked="{Binding ElementName=datePicker, Path=IsTodayHighlighted}" />
<CheckBox Content="IsTodayHighlighted" IsChecked="{Binding ElementName=datePicker, Path=IsTodayHighlighted}" Click="CheckBox_Click"/>

<CheckBox Content="IsDropDownOpen" IsChecked="{Binding ElementName=datePicker, Path=IsDropDownOpen}" />
<CheckBox Content="IsDropDownOpen" IsChecked="{Binding ElementName=datePicker, Path=IsDropDownOpen}" Click="CheckBox_Click"/>

<Button Click="BlackoutDatesInPast" Content="Blackout dates in the past" />

<CheckBox Content="IsEnabled" IsChecked="{Binding ElementName=datePicker, Path=IsEnabled}" />
<CheckBox Content="IsEnabled" IsChecked="{Binding ElementName=datePicker, Path=IsEnabled}" Click="CheckBox_Click"/>
</ikw:SimpleStackPanel>
</local:ControlExample.Options>
</local:ControlExample>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using iNKORE.UI.WPF.Modern;
using iNKORE.UI.WPF.Modern.Controls.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -24,21 +25,40 @@ public partial class DatePickerPage
public DatePickerPage()
{
InitializeComponent();

UpdateExampleCode();
}

private void BlackoutDatesInPast(object sender, RoutedEventArgs e)
{
datePicker.BlackoutDates.AddDatesInPast();
}

private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
UpdateExampleCode();
}

private void CheckBox_Click(object sender, RoutedEventArgs e)
{
UpdateExampleCode();
}

#region Example Code

public void UpdateExampleCode()
{

Example1.Xaml = Example1Xaml;
}

#endregion
public string Example1Xaml => $@"
<DatePicker x:Name=""datePicker"" IsEnabled=""{datePicker.IsEnabled}""
ui:ControlHelper.Header=""{ControlHelper.GetHeader(datePicker)}""
ui:ControlHelper.PlaceholderText=""{ControlHelper.GetPlaceholderText(datePicker)}""
ui:ControlHelper.Description=""{ControlHelper.GetDescription(datePicker)}""
IsTodayHighlighted=""{datePicker.IsTodayHighlighted}"" IsDropDownOpen=""{datePicker.IsDropDownOpen}"" />
";

#endregion
}
}

0 comments on commit 9a10296

Please sign in to comment.