Skip to content

feat: improve ImageToggledButton and add AuthenticationButton and Con… #163

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

Merged
merged 1 commit into from
May 13, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<UserControl
x:Class="Atc.Wpf.Sample.SamplesWpfControls.ButtonControls.AuthenticationButtonView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:atc="https://github.com/atc-net/atc-wpf/tree/main/schemas"
xmlns:atcValueConverters="https://github.com/atc-net/atc-wpf/tree/main/schemas/value-converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:fontIcons="clr-namespace:Atc.Wpf.FontIcons;assembly=Atc.Wpf.FontIcons"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<atc:AutoGrid Columns="*" Rows="Auto,*">

<GroupBox
Margin="0,0,0,10"
Padding="10"
Header="Features" />

<GroupBox Header="Usage">
<ScrollViewer>
<atc:GridEx Columns="*,10,*" ShowGridLines="True">
<atc:UniformSpacingPanel
Grid.Column="0"
Margin="10"
Orientation="Vertical"
Spacing="10">

<atc:UniformSpacingPanel
ItemWidth="100"
Orientation="Horizontal"
Spacing="10">

<atc:UniformSpacingPanel Orientation="Vertical" Spacing="10">

<atc:AuthenticationButton
IsAuthenticated="{Binding Path=IsAuthenticated}"
IsBusy="{Binding Path=IsBusy}"
LoginCommand="{Binding Path=LoginCommand}"
LogoutCommand="{Binding Path=LogoutCommand}" />

<atc:AuthenticationButton
IsAuthenticated="{Binding Path=IsAuthenticated}"
IsBusy="{Binding Path=IsBusy}"
LoginCommand="{Binding Path=LoginCommand}"
LoginContent="MyLogin"
LoginImageSource="{Binding Source={x:Static fontIcons:FontMaterialDesignType.Login}, Converter={x:Static atcValueConverters:FontIconImageSourceValueConverter.Instance}, ConverterParameter={StaticResource AtcApps.Brushes.ThemeForeground}}"
LogoutCommand="{Binding Path=LogoutCommand}"
LogoutContent="MyLogout"
LogoutImageSource="{Binding Source={x:Static fontIcons:FontMaterialDesignType.Logout}, Converter={x:Static atcValueConverters:FontIconImageSourceValueConverter.Instance}, ConverterParameter={StaticResource AtcApps.Brushes.Accent}}" />

</atc:UniformSpacingPanel>

</atc:UniformSpacingPanel>

</atc:UniformSpacingPanel>
<atc:UniformSpacingPanel
Grid.Column="2"
Margin="10"
Orientation="Vertical"
Spacing="10">

<atc:UniformSpacingPanel
ItemWidth="100"
Orientation="Horizontal"
Spacing="10">

<atc:UniformSpacingPanel Orientation="Vertical" Spacing="10" />

</atc:UniformSpacingPanel>

</atc:UniformSpacingPanel>
</atc:GridEx>
</ScrollViewer>
</GroupBox>
</atc:AutoGrid>

</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
namespace Atc.Wpf.Sample.SamplesWpfControls.ButtonControls;

public partial class AuthenticationButtonView
{
public AuthenticationButtonView()
{
InitializeComponent();

DataContext = this;
}

[DependencyProperty]
private bool isBusy;

[DependencyProperty]
private bool isAuthenticated;

[RelayCommand]
private async Task Login()
{
IsBusy = true;

await Task
.Delay(2_000)
.ConfigureAwait(false);

await Application.Current.Dispatcher
.InvokeAsyncIfRequired(() =>
{
IsAuthenticated = true;
IsBusy = false;
})
.ConfigureAwait(false);
}

[RelayCommand]
private async Task Logout()
{
IsBusy = true;

await Task
.Delay(500)
.ConfigureAwait(false);

await Application.Current.Dispatcher
.InvokeAsyncIfRequired(() =>
{
IsAuthenticated = false;
IsBusy = false;
})
.ConfigureAwait(false);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<UserControl
x:Class="Atc.Wpf.Sample.SamplesWpfControls.ButtonControls.ConnectivityButtonView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:atc="https://github.com/atc-net/atc-wpf/tree/main/schemas"
xmlns:atcValueConverters="https://github.com/atc-net/atc-wpf/tree/main/schemas/value-converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:fontIcons="clr-namespace:Atc.Wpf.FontIcons;assembly=Atc.Wpf.FontIcons"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<atc:AutoGrid Columns="*" Rows="Auto,*">

<GroupBox
Margin="0,0,0,10"
Padding="10"
Header="Features" />

<GroupBox Header="Usage">
<ScrollViewer>
<atc:GridEx Columns="*,10,*" ShowGridLines="True">
<atc:UniformSpacingPanel
Grid.Column="0"
Margin="10"
Orientation="Vertical"
Spacing="10">

<atc:UniformSpacingPanel
ItemWidth="100"
Orientation="Horizontal"
Spacing="10">

<atc:UniformSpacingPanel Orientation="Vertical" Spacing="10">

<atc:ConnectivityButton
ConnectCommand="{Binding Path=ConnectCommand}"
DisconnectCommand="{Binding Path=DisconnectCommand}"
IsBusy="{Binding Path=IsBusy}"
IsConnected="{Binding Path=IsConnected}" />

<atc:ConnectivityButton
ConnectCommand="{Binding Path=ConnectCommand}"
ConnectContent="MyConnect"
ConnectImageSource="{Binding Source={x:Static fontIcons:FontMaterialDesignType.Login}, Converter={x:Static atcValueConverters:FontIconImageSourceValueConverter.Instance}, ConverterParameter={StaticResource AtcApps.Brushes.ThemeForeground}}"
DisconnectCommand="{Binding Path=DisconnectCommand}"
DisconnectContent="MyDisconnect"
DisconnectImageSource="{Binding Source={x:Static fontIcons:FontMaterialDesignType.Logout}, Converter={x:Static atcValueConverters:FontIconImageSourceValueConverter.Instance}, ConverterParameter={StaticResource AtcApps.Brushes.Accent}}"
IsBusy="{Binding Path=IsBusy}"
IsConnected="{Binding Path=IsConnected}" />

</atc:UniformSpacingPanel>

</atc:UniformSpacingPanel>

</atc:UniformSpacingPanel>
<atc:UniformSpacingPanel
Grid.Column="2"
Margin="10"
Orientation="Vertical"
Spacing="10">

<atc:UniformSpacingPanel
ItemWidth="100"
Orientation="Horizontal"
Spacing="10">

<atc:UniformSpacingPanel Orientation="Vertical" Spacing="10" />

</atc:UniformSpacingPanel>

</atc:UniformSpacingPanel>
</atc:GridEx>
</ScrollViewer>
</GroupBox>
</atc:AutoGrid>

</UserControl>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace Atc.Wpf.Sample.SamplesWpfTheming.InputButton;
namespace Atc.Wpf.Sample.SamplesWpfControls.ButtonControls;

public partial class ImageToggledButton
public partial class ConnectivityButtonView
{
public ImageToggledButton()
public ConnectivityButtonView()
{
InitializeComponent();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<UserControl
x:Class="Atc.Wpf.Sample.SamplesWpfControls.BaseControls.ImageButtonView"
x:Class="Atc.Wpf.Sample.SamplesWpfControls.ButtonControls.ImageButtonView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:atc="https://github.com/atc-net/atc-wpf/tree/main/schemas"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Atc.Wpf.Sample.SamplesWpfControls.BaseControls;
namespace Atc.Wpf.Sample.SamplesWpfControls.ButtonControls;

public partial class ImageButtonView
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<UserControl
x:Class="Atc.Wpf.Sample.SamplesWpfTheming.InputButton.ImageToggledButton"
x:Class="Atc.Wpf.Sample.SamplesWpfControls.ButtonControls.ImageToggledButtonView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:atc="https://github.com/atc-net/atc-wpf/tree/main/schemas"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
namespace Atc.Wpf.Sample.SamplesWpfControls.ButtonControls;

public partial class ImageToggledButtonView
{
public ImageToggledButtonView()
{
InitializeComponent();

DataContext = this;
}

[DependencyProperty]
private bool isBusy;

[DependencyProperty]
private bool isConnected;

[RelayCommand]
private async Task Connect()
{
IsBusy = true;

await Task
.Delay(2_000)
.ConfigureAwait(false);

await Application.Current.Dispatcher
.InvokeAsyncIfRequired(() =>
{
IsConnected = true;
IsBusy = false;
})
.ConfigureAwait(false);
}

[RelayCommand]
private async Task Disconnect()
{
IsBusy = true;

await Task
.Delay(500)
.ConfigureAwait(false);

await Application.Current.Dispatcher
.InvokeAsyncIfRequired(() =>
{
IsConnected = false;
IsBusy = false;
})
.ConfigureAwait(false);
}
}
24 changes: 20 additions & 4 deletions sample/Atc.Wpf.Sample/SamplesWpfControlsTreeView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
IsExpanded="True"
SamplePath="DialogBoxes.StandardDialogBoxView" />
</TreeViewItem>

<TreeViewItem Header="Base Controls">
<sample:SampleTreeViewItem
Header="DecimalBox"
Expand All @@ -24,10 +25,6 @@
Header="DecimalXyBox"
IsExpanded="True"
SamplePath="BaseControls.DecimalXyBoxView" />
<sample:SampleTreeViewItem
Header="ImageButton"
IsExpanded="True"
SamplePath="BaseControls.ImageButtonView" />
<sample:SampleTreeViewItem
Header="IntegerBox"
IsExpanded="True"
Expand Down Expand Up @@ -66,6 +63,25 @@
SamplePath="BaseControls.RichTextBoxExView" />
</TreeViewItem>

<TreeViewItem Header="Button Controls">
<sample:SampleTreeViewItem
Header="AuthenticationButton"
IsExpanded="True"
SamplePath="ButtonControls.AuthenticationButtonView" />
<sample:SampleTreeViewItem
Header="ConnectivityButton"
IsExpanded="True"
SamplePath="ButtonControls.ConnectivityButtonView" />
<sample:SampleTreeViewItem
Header="ImageButton"
IsExpanded="True"
SamplePath="ButtonControls.ImageButtonView" />
<sample:SampleTreeViewItem
Header="ImageToggledButton"
IsExpanded="True"
SamplePath="ButtonControls.ImageToggledButtonView" />
</TreeViewItem>

<TreeViewItem Header="Color Controls">
<sample:SampleTreeViewItem
Header="AdvancedColorPickerView"
Expand Down
4 changes: 0 additions & 4 deletions sample/Atc.Wpf.Sample/SamplesWpfThemingTreeView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
Header="ImageButton"
IsExpanded="True"
SamplePath="InputButton.ImageButtonView" />
<sample:SampleTreeViewItem
Header="ImageToggledButton"
IsExpanded="True"
SamplePath="InputButton.ImageToggledButton" />
<TreeViewItem
Header="ToggleButton"
IsEnabled="False"
Expand Down
2 changes: 2 additions & 0 deletions src/Atc.Wpf.Controls/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
[assembly: XmlnsPrefix("https://github.com/atc-net/atc-wpf/tree/main/schemas", "atc")]
[assembly: XmlnsDefinition("https://github.com/atc-net/atc-wpf/tree/main/schemas", "Atc.Wpf.Controls")]
[assembly: XmlnsDefinition("https://github.com/atc-net/atc-wpf/tree/main/schemas", "Atc.Wpf.Controls.BaseControls")]
[assembly: XmlnsDefinition("https://github.com/atc-net/atc-wpf/tree/main/schemas", "Atc.Wpf.Controls.ButtonControls")]
[assembly: XmlnsDefinition("https://github.com/atc-net/atc-wpf/tree/main/schemas", "Atc.Wpf.Controls.ColorControls")]
[assembly: XmlnsDefinition("https://github.com/atc-net/atc-wpf/tree/main/schemas", "Atc.Wpf.Controls.Dialogs")]
[assembly: XmlnsDefinition("https://github.com/atc-net/atc-wpf/tree/main/schemas", "Atc.Wpf.Controls.LabelControls")]
[assembly: XmlnsDefinition("https://github.com/atc-net/atc-wpf/tree/main/schemas", "Atc.Wpf.Controls.Layouts")]
Expand Down
2 changes: 1 addition & 1 deletion src/Atc.Wpf.Controls/Atc.Wpf.Controls.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0-windows</TargetFramework>
Expand Down
Loading
Loading