Skip to content

Feature/maintenance #160

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 2 commits into from
May 5, 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
4 changes: 2 additions & 2 deletions sample/Atc.Wpf.Sample/Atc.Wpf.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@

<ItemGroup>
<PackageReference Include="Atc" Version="2.0.552" />
<PackageReference Include="Atc.XamlToolkit" Version="1.5.30" />
<PackageReference Include="Atc.XamlToolkit.Wpf" Version="1.5.30" />
<PackageReference Include="Atc.XamlToolkit" Version="1.5.34" />
<PackageReference Include="Atc.XamlToolkit.Wpf" Version="1.5.34" />
<PackageReference Include="ControlzEx" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.4" />
<PackageReference Include="Microsoft.Extensions.Options.DataAnnotations" Version="9.0.4" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,64 +28,62 @@
</GroupBox>

<GroupBox Header="Usage">
<ScrollViewer>

<atc:StaggeredPanel
Padding="50"
DesiredItemWidth="{Binding ElementName=LsDesiredItemWidth, Path=Value}"
HorizontalSpacing="{Binding ElementName=LsHorizontalSpacing, Path=Value}"
VerticalSpacing="{Binding ElementName=LsVerticalSpacing, Path=Value}">
<Rectangle
Width="50"
Height="50"
Fill="Blue" />
<Rectangle
Width="50"
Height="50"
Fill="Red" />
<Rectangle
Width="50"
Height="50"
Fill="Green" />
<Rectangle
Width="50"
Height="50"
Fill="Yellow" />
<Rectangle
Width="50"
Height="50"
Fill="Blue" />
<Rectangle
Width="50"
Height="50"
Fill="Red" />
<Rectangle
Width="50"
Height="50"
Fill="Green" />
<Rectangle
Width="50"
Height="50"
Fill="Yellow" />
<Rectangle
Width="50"
Height="50"
Fill="Blue" />
<Rectangle
Width="50"
Height="50"
Fill="Red" />
<Rectangle
Width="50"
Height="50"
Fill="Green" />
<Rectangle
Width="50"
Height="50"
Fill="Yellow" />
</atc:StaggeredPanel>
<atc:StaggeredPanel
Padding="50"
DesiredItemWidth="{Binding ElementName=LsDesiredItemWidth, Path=Value}"
HorizontalSpacing="{Binding ElementName=LsHorizontalSpacing, Path=Value}"
VerticalSpacing="{Binding ElementName=LsVerticalSpacing, Path=Value}">
<Rectangle
Width="50"
Height="50"
Fill="Blue" />
<Rectangle
Width="50"
Height="50"
Fill="Red" />
<Rectangle
Width="50"
Height="50"
Fill="Green" />
<Rectangle
Width="50"
Height="50"
Fill="Yellow" />
<Rectangle
Width="50"
Height="50"
Fill="Blue" />
<Rectangle
Width="50"
Height="50"
Fill="Red" />
<Rectangle
Width="50"
Height="50"
Fill="Green" />
<Rectangle
Width="50"
Height="50"
Fill="Yellow" />
<Rectangle
Width="50"
Height="50"
Fill="Blue" />
<Rectangle
Width="50"
Height="50"
Fill="Red" />
<Rectangle
Width="50"
Height="50"
Fill="Green" />
<Rectangle
Width="50"
Height="50"
Fill="Yellow" />
</atc:StaggeredPanel>

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,38 @@
Margin="0,0,0,10"
Padding="10"
Header="Features">
<atc:UniformSpacingPanel
Width="250"
Orientation="Vertical"
Spacing="10">
<atc:LabelIntegerBox
HideAreas="All"
LabelText="Basic Width"
Maximum="1000"
Minimum="0"
Value="{Binding ElementName=UcBasicColors, Path=Width}" />
<atc:LabelIntegerBox
HideAreas="All"
LabelText="Available Width"
Maximum="1000"
Minimum="0"
Value="{Binding ElementName=UcAvailableColors, Path=Width}" />
<atc:UniformSpacingPanel Orientation="Horizontal">
<atc:UniformSpacingPanel
Width="250"
VerticalAlignment="Center"
Orientation="Vertical"
Spacing="10">
<Rectangle
Width="100"
Height="20"
Fill="{Binding ElementName=UcBasicColors, Path=ColorBrush, Mode=OneWay}" />
<Rectangle
Width="100"
Height="20"
Fill="{Binding ElementName=UcAvailableColors, Path=ColorBrush, Mode=OneWay}" />
</atc:UniformSpacingPanel>
<atc:UniformSpacingPanel
Width="250"
Orientation="Vertical"
Spacing="10">
<atc:LabelIntegerBox
HideAreas="All"
LabelText="Basic Width"
Maximum="1000"
Minimum="0"
Value="{Binding ElementName=UcBasicColors, Path=Width}" />
<atc:LabelIntegerBox
HideAreas="All"
LabelText="Available Width"
Maximum="1000"
Minimum="0"
Value="{Binding ElementName=UcAvailableColors, Path=Width}" />
</atc:UniformSpacingPanel>
</atc:UniformSpacingPanel>
</GroupBox>

Expand Down
19 changes: 5 additions & 14 deletions src/Atc.Wpf.Controls/Adorners/PointPickerAdorner.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
namespace Atc.Wpf.Controls.Adorners;

public sealed class PointPickerAdorner : Adorner
public sealed partial class PointPickerAdorner : Adorner
{
private static readonly Brush FillBrush = Brushes.Transparent;
private readonly Pen selectorPen;

private static readonly DependencyProperty PositionProperty = DependencyProperty.Register(
nameof(Position),
typeof(Point),
typeof(PointPickerAdorner),
new FrameworkPropertyMetadata(
default(Point),
FrameworkPropertyMetadataOptions.AffectsRender));

public Point Position
{
get => (Point)GetValue(PositionProperty);
set => SetValue(PositionProperty, value);
}
[DependencyProperty(
DefaultValue = "default(Point)",
Flags = FrameworkPropertyMetadataOptions.AffectsRender)]
private Point position;

public PointPickerAdorner(
UIElement adornedElement)
Expand Down
4 changes: 2 additions & 2 deletions src/Atc.Wpf.Controls/Atc.Wpf.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@

<ItemGroup>
<PackageReference Include="Atc" Version="2.0.552" />
<PackageReference Include="Atc.XamlToolkit" Version="1.5.30" />
<PackageReference Include="Atc.XamlToolkit.Wpf" Version="1.5.30" />
<PackageReference Include="Atc.XamlToolkit" Version="1.5.34" />
<PackageReference Include="Atc.XamlToolkit.Wpf" Version="1.5.34" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

Expand Down
13 changes: 2 additions & 11 deletions src/Atc.Wpf.Controls/BaseControls/ClockPanelPicker.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,8 @@ public event EventHandler<RoutedEventArgs> SelectedClockChanged
remove => RemoveHandler(SelectedClockChangedEvent, value);
}

public static readonly DependencyProperty SelectedDateTimeProperty = DependencyProperty.Register(
nameof(SelectedDateTime),
typeof(DateTime?),
typeof(ClockPanelPicker),
new PropertyMetadata(default(DateTime?)));

public DateTime? SelectedDateTime
{
get => (DateTime?)GetValue(SelectedDateTimeProperty);
set => SetValue(SelectedDateTimeProperty, value);
}
[DependencyProperty(DefaultValue = "default(DateTime?)")]
private DateTime? selectedDateTime;

public ClockPanelPicker()
{
Expand Down
19 changes: 7 additions & 12 deletions src/Atc.Wpf.Controls/BaseControls/ColorPicker.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,26 @@ namespace Atc.Wpf.Controls.BaseControls;

public partial class ColorPicker
{
public static readonly DependencyProperty RenderColorIndicatorTypeProperty = DependencyProperty.Register(
nameof(RenderColorIndicatorType),
typeof(RenderColorIndicatorType),
typeof(ColorPicker),
new PropertyMetadata(RenderColorIndicatorType.Square));

public RenderColorIndicatorType RenderColorIndicatorType
{
get => (RenderColorIndicatorType)GetValue(RenderColorIndicatorTypeProperty);
set => SetValue(RenderColorIndicatorTypeProperty, value);
}
[DependencyProperty(DefaultValue = RenderColorIndicatorType.Square)]
private RenderColorIndicatorType renderColorIndicatorType;

// Note: DependencyProperty-SourceGenerator don't support "typeof(Color) as null" for now
public static readonly DependencyProperty ColorValueProperty = DependencyProperty.Register(
nameof(ColorValue),
typeof(Color),
typeof(ColorPicker),
typeof(LabelColorPicker),
new PropertyMetadata(
Colors.Black,
OnColorValueChanged));

// Note: DependencyProperty-SourceGenerator don't support "typeof(Color) as null" for now
public Color? ColorValue
{
get => (Color?)GetValue(ColorValueProperty);
set => SetValue(ColorValueProperty, value);
}

// Note: DependencyProperty-SourceGenerator don't support "typeof(SolidColorBrush) as null" for now
public static readonly DependencyProperty BrushValueProperty = DependencyProperty.Register(
nameof(BrushValue),
typeof(SolidColorBrush),
Expand All @@ -36,6 +30,7 @@ public Color? ColorValue
Brushes.Black,
OnBrushValueChanged));

// Note: DependencyProperty-SourceGenerator don't support "typeof(SolidColorBrush) as null" for now
public SolidColorBrush? BrushValue
{
get => (SolidColorBrush?)GetValue(BrushValueProperty);
Expand Down
22 changes: 9 additions & 13 deletions src/Atc.Wpf.Controls/ColorControls/WellKnownColorPicker.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,26 @@ namespace Atc.Wpf.Controls.ColorControls;
[SuppressMessage("Design", "CA1002:Do not expose generic lists", Justification = "OK.")]
public partial class WellKnownColorPicker
{
public static readonly DependencyProperty ShowOnlyBasicColorsProperty = DependencyProperty.Register(
nameof(ShowOnlyBasicColors),
typeof(bool),
typeof(WellKnownColorPicker),
new PropertyMetadata(
BooleanBoxes.FalseBox,
OnShowOnlyStandardChanged));

public bool ShowOnlyBasicColors
{
get => (bool)GetValue(ShowOnlyBasicColorsProperty);
set => SetValue(ShowOnlyBasicColorsProperty, value);
}
[DependencyProperty(DefaultValue = false, PropertyChangedCallback = nameof(OnShowOnlyStandardChanged))]
private bool showOnlyBasicColors;

// Note: DependencyProperty-SourceGenerator don't support "List<ColorItem>" for now
public static readonly DependencyProperty PaletteProperty = DependencyProperty.Register(
nameof(Palette),
typeof(List<ColorItem>),
typeof(WellKnownColorPicker),
new PropertyMetadata(default(List<ColorItem>)));

// Note: DependencyProperty-SourceGenerator don't support "List<ColorItem>" for now
public List<ColorItem> Palette
{
get => (List<ColorItem>)GetValue(PaletteProperty);
set => SetValue(PaletteProperty, value);
}

[DependencyProperty(DefaultValue = "Transparent")]
private Brush colorBrush;

public event EventHandler<ValueChangedEventArgs<Color>>? ColorChanged;

public WellKnownColorPicker()
Expand Down Expand Up @@ -67,5 +61,7 @@ private void OnPaletteColorClick(
ControlHelper.GetIdentifier(this),
oldValue: default,
color));

ColorBrush = new SolidColorBrush(color);
}
}
1 change: 1 addition & 0 deletions src/Atc.Wpf.Controls/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
global using Atc.Wpf.Translation;
global using Atc.Wpf.ValueConverters;
global using Atc.XamlToolkit.Command;
global using Atc.XamlToolkit.Controls.Attributes;
global using Atc.XamlToolkit.Messaging;
global using Atc.XamlToolkit.Mvvm;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ public static LabelWellKnownColorSelector CreateLabelWellKnownColorSelector(
IsMandatory = isMandatory,
InputDataType = inputDataType,
DropDownFirstItemType = DropDownFirstItemType.PleaseSelect,
DefaultColorName = defaultColorName,
DefaultColorName = defaultColorName ?? string.Empty,
};

return control;
Expand Down Expand Up @@ -821,7 +821,7 @@ public static LabelCountrySelector CreateLabelCountrySelector(
IsMandatory = isMandatory,
InputDataType = inputDataType,
DropDownFirstItemType = DropDownFirstItemType.PleaseSelect,
DefaultCultureIdentifier = defaultCultureIdentifier,
DefaultCultureIdentifier = defaultCultureIdentifier ?? string.Empty,
UseOnlySupportedCountries = false,
};

Expand Down Expand Up @@ -861,7 +861,7 @@ public static LabelLanguageSelector CreateLabelLanguageSelector(
IsMandatory = isMandatory,
InputDataType = inputDataType,
DropDownFirstItemType = DropDownFirstItemType.PleaseSelect,
DefaultCultureIdentifier = defaultCultureIdentifier,
DefaultCultureIdentifier = defaultCultureIdentifier ?? string.Empty,
UseOnlySupportedLanguages = false,
UpdateUiCultureOnChangeEvent = false,
};
Expand Down
Loading
Loading