Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/support readme markdown in sample viewer #113

Merged
merged 18 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading