Skip to content

Commit

Permalink
Merge pull request #113 from atc-net/feature/Support-readme-markdown-…
Browse files Browse the repository at this point in the history
…in-SampleViewer

Feature/support readme markdown in sample viewer
  • Loading branch information
davidkallesen authored Mar 10, 2024
2 parents 3a90f5e + bcbcc8d commit 30bd8f2
Show file tree
Hide file tree
Showing 54 changed files with 1,758 additions and 451 deletions.
204 changes: 47 additions & 157 deletions README.md

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion sample/Atc.Wpf.Sample/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,22 @@
<ResourceDictionary Source="pack://application:,,,/Atc.Wpf.Controls;component/Styles/Controls.xaml" />
</ResourceDictionary.MergedDictionaries>

<Style BasedOn="{StaticResource AtcApps.Styles.TreeViewItem}" TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="True" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Foreground" Value="{DynamicResource AtcApps.Brushes.ThemeForeground4}" />
</Style>

<Style BasedOn="{StaticResource AtcApps.Styles.TreeViewItem}" TargetType="{x:Type atc:SampleTreeViewItem}">
<Setter Property="IsExpanded" Value="True" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Foreground" Value="{DynamicResource AtcApps.Brushes.ThemeForeground}" />
</Style>

<Style BasedOn="{StaticResource AtcApps.Styles.TreeView}" TargetType="{x:Type sample:SamplesWpfTreeView}" />
<Style BasedOn="{StaticResource AtcApps.Styles.TreeView}" TargetType="{x:Type sample:SamplesWpfControlsTreeView}" />
<Style BasedOn="{StaticResource AtcApps.Styles.TreeView}" TargetType="{x:Type sample:SamplesWpfFontIconsTreeView}" />
<Style BasedOn="{StaticResource AtcApps.Styles.TreeView}" TargetType="{x:Type sample:SamplesWpfThemingTreeView}" />
<Style BasedOn="{StaticResource AtcApps.Styles.TreeViewItem}" TargetType="{x:Type atc:SampleTreeViewItem}" />

</ResourceDictionary>
</Application.Resources>
Expand Down
2 changes: 1 addition & 1 deletion sample/Atc.Wpf.Sample/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ await host

ThemeManager.Current.ChangeTheme(
Current,
"Dark.Blue");
"Light.Blue");

var mainWindow = host
.Services
Expand Down
5 changes: 4 additions & 1 deletion sample/Atc.Wpf.Sample/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
DockPanel.Dock="Top"
Focusable="True"
TextChanged="SampleFilterOnTextChanged" />
<TabControl DockPanel.Dock="Bottom" TabStripPlacement="Left">
<TabControl
Margin="0,0,5,10"
DockPanel.Dock="Bottom"
TabStripPlacement="Left">
<TabItem Header="Wpf">
<sample:SamplesWpfTreeView
x:Name="StvSampleWpf"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,30 @@
<GroupBox Header="Usage">
<ScrollViewer>

<StackPanel Margin="10" Orientation="Vertical">
<StackPanel Margin="10" Orientation="Vertical">
<Button Command="{Binding Path=Test1Command}" Content="Button with no canExecute" />
</StackPanel>
<StackPanel Margin="10" Orientation="Vertical">
<CheckBox
Margin="0,0,0,10"
Content="IsTestEnabled"
IsChecked="{Binding Path=IsTestEnabled}" />
<Button Command="{Binding Path=Test2Command}" Content="Button with canExecute depend on Checkbox 'IsTestEnabled'" />
</StackPanel>
<StackPanel Margin="10" Orientation="Vertical">
<Button
Command="{Binding Path=Test3Command}"
CommandParameter="Hello"
Content="Button with no canExecute, and have a string as CommandParameter" />
</StackPanel>
</StackPanel>
<atc:UniformSpacingPanel
Margin="40"
Orientation="Vertical"
Spacing="20">

<Button Command="{Binding Path=Test1Command}" Content="Button with no canExecute" />

<CheckBox
Margin="0,0,0,10"
Content="IsTestEnabled"
IsChecked="{Binding Path=IsTestEnabled}" />
<Button Command="{Binding Path=Test2Command}" Content="Button with canExecute depend on Checkbox 'IsTestEnabled'" />

<Button
Command="{Binding Path=Test3Command}"
CommandParameter="Hello"
Content="Button with no canExecute, and have a string as CommandParameter" />

<Button
Command="{Binding Path=Test4Command}"
CommandParameter="Hello word"
Content="Button with canExecute method depend on Checkbox 'IsTestEnabled', and have a string as CommandParameter" />

</atc:UniformSpacingPanel>

</ScrollViewer>
</GroupBox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class RelayCommandAsyncViewModel : ViewModelBase

public IRelayCommandAsync<string> Test3Command => new RelayCommandAsync<string>(Test3CommandHandler);

public IRelayCommandAsync<string> Test4Command => new RelayCommandAsync<string>(Test4CommandHandler, CanTest4CommandHandler);

public bool IsTestEnabled
{
get => isTestEnabled;
Expand Down Expand Up @@ -37,4 +39,15 @@ private async Task Test3CommandHandler(string obj)
await Task.Delay(1000, CancellationToken.None).ConfigureAwait(false);
_ = MessageBox.Show("Test3-command is hit", $"CommandParameter: {obj}", MessageBoxButton.OK);
}

private bool CanTest4CommandHandler(string obj)
{
return IsTestEnabled;
}

private async Task Test4CommandHandler(string obj)
{
await Task.Delay(1000, CancellationToken.None).ConfigureAwait(false);
_ = MessageBox.Show("Test4-command is hit", $"CommandParameter: {obj}", MessageBoxButton.OK);
}
}
42 changes: 24 additions & 18 deletions sample/Atc.Wpf.Sample/SamplesWpf/Commands/RelayCommandView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,30 @@
<GroupBox Header="Usage">
<ScrollViewer>

<StackPanel Margin="10" Orientation="Vertical">
<StackPanel Margin="10" Orientation="Vertical">
<Button Command="{Binding Path=Test1Command}" Content="Button with no canExecute" />
</StackPanel>
<StackPanel Margin="10" Orientation="Vertical">
<CheckBox
Margin="0,0,0,10"
Content="IsTestEnabled"
IsChecked="{Binding Path=IsTestEnabled}" />
<Button Command="{Binding Path=Test2Command}" Content="Button with canExecute depend on Checkbox 'IsTestEnabled'" />
</StackPanel>
<StackPanel Margin="10" Orientation="Vertical">
<Button
Command="{Binding Path=Test3Command}"
CommandParameter="Hello"
Content="Button with no canExecute, and have a string as CommandParameter" />
</StackPanel>
</StackPanel>
<atc:UniformSpacingPanel
Margin="40"
Orientation="Vertical"
Spacing="20">

<Button Command="{Binding Path=Test1Command}" Content="Button with no canExecute" />

<CheckBox
Margin="0,0,0,10"
Content="IsTestEnabled"
IsChecked="{Binding Path=IsTestEnabled}" />
<Button Command="{Binding Path=Test2Command}" Content="Button with canExecute depend on Checkbox 'IsTestEnabled'" />

<Button
Command="{Binding Path=Test3Command}"
CommandParameter="Hello"
Content="Button with no canExecute, and have a string as CommandParameter" />

<Button
Command="{Binding Path=Test4Command}"
CommandParameter="Hello word"
Content="Button with canExecute method depend on Checkbox 'IsTestEnabled', and have a string as CommandParameter" />

</atc:UniformSpacingPanel>

</ScrollViewer>
</GroupBox>
Expand Down
12 changes: 12 additions & 0 deletions sample/Atc.Wpf.Sample/SamplesWpf/Commands/RelayCommandViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class RelayCommandViewModel : ViewModelBase

public IRelayCommand<string> Test3Command => new RelayCommand<string>(Test3CommandHandler);

public IRelayCommand<string> Test4Command => new RelayCommand<string>(Test4CommandHandler, CanTest4CommandHandler);

public bool IsTestEnabled
{
get => isTestEnabled;
Expand All @@ -34,4 +36,14 @@ private void Test3CommandHandler(string obj)
{
_ = MessageBox.Show("Test3-command is hit", $"CommandParameter: {obj}", MessageBoxButton.OK);
}

private bool CanTest4CommandHandler(string obj)
{
return IsTestEnabled;
}

private void Test4CommandHandler(string obj)
{
_ = MessageBox.Show("Test4-command is hit", $"CommandParameter: {obj}", MessageBoxButton.OK);
}
}
Loading

0 comments on commit 30bd8f2

Please sign in to comment.