Skip to content

Commit dd3d352

Browse files
committed
refactor: update nuget for Atc.XamlToolkit, and fix some "Note: DependencyProperty-SourceGenerator don't support"
1 parent 4a5bc31 commit dd3d352

File tree

15 files changed

+78
-225
lines changed

15 files changed

+78
-225
lines changed

sample/Atc.Wpf.Sample/Atc.Wpf.Sample.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151

5252
<ItemGroup>
5353
<PackageReference Include="Atc" Version="2.0.552" />
54-
<PackageReference Include="Atc.XamlToolkit" Version="1.5.34" />
55-
<PackageReference Include="Atc.XamlToolkit.Wpf" Version="1.5.34" />
54+
<PackageReference Include="Atc.XamlToolkit" Version="1.5.36" />
55+
<PackageReference Include="Atc.XamlToolkit.Wpf" Version="1.5.36" />
5656
<PackageReference Include="ControlzEx" Version="7.0.0" />
5757
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.4" />
5858
<PackageReference Include="Microsoft.Extensions.Options.DataAnnotations" Version="9.0.4" />

sample/Atc.Wpf.Sample/GlobalUsings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
global using Atc.Serialization.JsonConverters;
2525
global using Atc.Wpf.Collections;
2626
global using Atc.Wpf.Controls;
27-
global using Atc.Wpf.Controls.Data.Models;
2827
global using Atc.Wpf.Controls.Dialogs;
2928
global using Atc.Wpf.Controls.LabelControls;
3029
global using Atc.Wpf.Controls.LabelControls.Abstractions;

src/Atc.Wpf.Controls/Atc.Wpf.Controls.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848

4949
<ItemGroup>
5050
<PackageReference Include="Atc" Version="2.0.552" />
51-
<PackageReference Include="Atc.XamlToolkit" Version="1.5.34" />
52-
<PackageReference Include="Atc.XamlToolkit.Wpf" Version="1.5.34" />
51+
<PackageReference Include="Atc.XamlToolkit" Version="1.5.36" />
52+
<PackageReference Include="Atc.XamlToolkit.Wpf" Version="1.5.36" />
5353
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
5454
</ItemGroup>
5555

src/Atc.Wpf.Controls/BaseControls/ColorPicker.xaml.cs

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,15 @@ public partial class ColorPicker
55
[DependencyProperty(DefaultValue = RenderColorIndicatorType.Square)]
66
private RenderColorIndicatorType renderColorIndicatorType;
77

8-
// Note: DependencyProperty-SourceGenerator don't support "typeof(Color) as null" for now
9-
public static readonly DependencyProperty ColorValueProperty = DependencyProperty.Register(
10-
nameof(ColorValue),
11-
typeof(Color),
12-
typeof(LabelColorPicker),
13-
new PropertyMetadata(
14-
Colors.Black,
15-
OnColorValueChanged));
16-
17-
// Note: DependencyProperty-SourceGenerator don't support "typeof(Color) as null" for now
18-
public Color? ColorValue
19-
{
20-
get => (Color?)GetValue(ColorValueProperty);
21-
set => SetValue(ColorValueProperty, value);
22-
}
23-
24-
// Note: DependencyProperty-SourceGenerator don't support "typeof(SolidColorBrush) as null" for now
25-
public static readonly DependencyProperty BrushValueProperty = DependencyProperty.Register(
26-
nameof(BrushValue),
27-
typeof(SolidColorBrush),
28-
typeof(ColorPicker),
29-
new PropertyMetadata(
30-
Brushes.Black,
31-
OnBrushValueChanged));
32-
33-
// Note: DependencyProperty-SourceGenerator don't support "typeof(SolidColorBrush) as null" for now
34-
public SolidColorBrush? BrushValue
35-
{
36-
get => (SolidColorBrush?)GetValue(BrushValueProperty);
37-
set => SetValue(BrushValueProperty, value);
38-
}
8+
[DependencyProperty(
9+
DefaultValue = "Black",
10+
PropertyChangedCallback = nameof(OnColorValueChanged))]
11+
private Color? colorValue;
12+
13+
[DependencyProperty(
14+
DefaultValue = "Black",
15+
PropertyChangedCallback = nameof(OnBrushValueChanged))]
16+
private SolidColorBrush? brushValue;
3917

4018
public static readonly DependencyProperty DisplayHexCodeProperty = DependencyProperty.Register(
4119
nameof(DisplayHexCode),

src/Atc.Wpf.Controls/ColorControls/WellKnownColorPicker.xaml.cs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,8 @@ public partial class WellKnownColorPicker
66
[DependencyProperty(DefaultValue = false, PropertyChangedCallback = nameof(OnShowOnlyStandardChanged))]
77
private bool showOnlyBasicColors;
88

9-
// Note: DependencyProperty-SourceGenerator don't support "List<ColorItem>" for now
10-
public static readonly DependencyProperty PaletteProperty = DependencyProperty.Register(
11-
nameof(Palette),
12-
typeof(List<ColorItem>),
13-
typeof(WellKnownColorPicker),
14-
new PropertyMetadata(default(List<ColorItem>)));
15-
16-
// Note: DependencyProperty-SourceGenerator don't support "List<ColorItem>" for now
17-
public List<ColorItem> Palette
18-
{
19-
get => (List<ColorItem>)GetValue(PaletteProperty);
20-
set => SetValue(PaletteProperty, value);
21-
}
9+
[DependencyProperty]
10+
private List<ColorItem> palette;
2211

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

src/Atc.Wpf.Controls/LabelControls/LabelColorPicker.xaml.cs

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,15 @@ public partial class LabelColorPicker : ILabelColorPicker
55
[DependencyProperty(DefaultValue = RenderColorIndicatorType.Square)]
66
private RenderColorIndicatorType renderColorIndicatorType;
77

8-
// Note: DependencyProperty-SourceGenerator don't support "typeof(Color) as null" for now
9-
public static readonly DependencyProperty ColorValueProperty = DependencyProperty.Register(
10-
nameof(ColorValue),
11-
typeof(Color),
12-
typeof(LabelColorPicker),
13-
new PropertyMetadata(
14-
Colors.Black,
15-
OnColorValueChanged));
16-
17-
// Note: DependencyProperty-SourceGenerator don't support "typeof(Color) as null" for now
18-
public Color? ColorValue
19-
{
20-
get => (Color?)GetValue(ColorValueProperty);
21-
set => SetValue(ColorValueProperty, value);
22-
}
23-
24-
// Note: DependencyProperty-SourceGenerator don't support "typeof(SolidColorBrush) as null" for now
25-
public static readonly DependencyProperty BrushValueProperty = DependencyProperty.Register(
26-
nameof(BrushValue),
27-
typeof(SolidColorBrush),
28-
typeof(LabelColorPicker),
29-
new PropertyMetadata(
30-
Brushes.Black,
31-
OnBrushValueChanged));
32-
33-
// Note: DependencyProperty-SourceGenerator don't support "typeof(SolidColorBrush) as null" for now
34-
public SolidColorBrush? BrushValue
35-
{
36-
get => (SolidColorBrush?)GetValue(BrushValueProperty);
37-
set => SetValue(BrushValueProperty, value);
38-
}
8+
[DependencyProperty(
9+
DefaultValue = "Black",
10+
PropertyChangedCallback = nameof(OnColorValueChanged))]
11+
private Color? colorValue;
12+
13+
[DependencyProperty(
14+
DefaultValue = "Black",
15+
PropertyChangedCallback = nameof(OnBrushValueChanged))]
16+
private SolidColorBrush? brushValue;
3917

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

src/Atc.Wpf.Controls/LabelControls/LabelComboBox.xaml.cs

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,16 @@ namespace Atc.Wpf.Controls.LabelControls;
22

33
public partial class LabelComboBox : ILabelComboBox
44
{
5-
// Note: DependencyProperty-SourceGenerator don't support "Dictionary<string, string>" for now
6-
public static readonly DependencyProperty ItemsProperty = DependencyProperty.Register(
7-
nameof(Items),
8-
typeof(Dictionary<string, string>),
9-
typeof(LabelComboBox),
10-
new PropertyMetadata(default(Dictionary<string, string>)));
11-
12-
// Note: DependencyProperty-SourceGenerator don't support "Dictionary<string, string>" for now
13-
public Dictionary<string, string> Items
14-
{
15-
get => (Dictionary<string, string>)GetValue(ItemsProperty);
16-
set => SetValue(ItemsProperty, value);
17-
}
18-
19-
// Note: DependencyProperty-SourceGenerator don't support "coerceValueCallback / isAnimationProhibited" correctly for now
20-
public static readonly DependencyProperty SelectedKeyProperty = DependencyProperty.Register(
21-
nameof(SelectedKey),
22-
typeof(string),
23-
typeof(LabelComboBox),
24-
new FrameworkPropertyMetadata(
25-
defaultValue: null,
26-
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
27-
OnSelectedKeyLostFocus,
28-
coerceValueCallback: null,
29-
isAnimationProhibited: true,
30-
UpdateSourceTrigger.LostFocus));
31-
32-
// Note: DependencyProperty-SourceGenerator don't support "coerceValueCallback / isAnimationProhibited" correctly for now
33-
public string SelectedKey
34-
{
35-
get => (string)GetValue(SelectedKeyProperty);
36-
set => SetValue(SelectedKeyProperty, value);
37-
}
5+
[DependencyProperty]
6+
private Dictionary<string, string> items;
7+
8+
[DependencyProperty(
9+
DefaultValue = "",
10+
Flags = FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
11+
PropertyChangedCallback = nameof(OnSelectedKeyLostFocus),
12+
IsAnimationProhibited = true,
13+
DefaultUpdateSourceTrigger = UpdateSourceTrigger.LostFocus)]
14+
private string selectedKey;
3815

3916
public event EventHandler<ValueChangedEventArgs<string?>>? SelectorChanged;
4017

src/Atc.Wpf.Controls/LabelControls/Selectors/LabelCountrySelector.xaml.cs

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,13 @@ public partial class LabelCountrySelector : ILabelCountrySelector
1616
[DependencyProperty]
1717
private string defaultCultureIdentifier;
1818

19-
// Note: DependencyProperty-SourceGenerator don't support "coerceValueCallback / isAnimationProhibited" correctly for now
20-
public static readonly DependencyProperty SelectedKeyProperty = DependencyProperty.Register(
21-
nameof(SelectedKey),
22-
typeof(string),
23-
typeof(LabelCountrySelector),
24-
new FrameworkPropertyMetadata(
25-
string.Empty,
26-
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
27-
OnSelectorLostFocus,
28-
coerceValueCallback: null,
29-
isAnimationProhibited: true,
30-
UpdateSourceTrigger.LostFocus));
31-
32-
// Note: DependencyProperty-SourceGenerator don't support "coerceValueCallback / isAnimationProhibited" correctly for now
33-
public string SelectedKey
34-
{
35-
get => (string)GetValue(SelectedKeyProperty);
36-
set => SetValue(SelectedKeyProperty, value);
37-
}
19+
[DependencyProperty(
20+
DefaultValue = "",
21+
Flags = FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
22+
PropertyChangedCallback = nameof(OnSelectedLostFocus),
23+
IsAnimationProhibited = true,
24+
DefaultUpdateSourceTrigger = UpdateSourceTrigger.LostFocus)]
25+
private string selectedKey;
3826

3927
public event EventHandler<ValueChangedEventArgs<string?>>? SelectorChanged;
4028

@@ -112,7 +100,7 @@ private static void ValidateValue(
112100
selectedKey));
113101
}
114102

115-
private static void OnSelectorLostFocus(
103+
private static void OnSelectedLostFocus(
116104
DependencyObject d,
117105
DependencyPropertyChangedEventArgs e)
118106
{

src/Atc.Wpf.Controls/LabelControls/Selectors/LabelFontFamilySelector.xaml.cs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,13 @@ public partial class LabelFontFamilySelector : ILabelFontFamilySelector
77
[DependencyProperty(DefaultValue = DropDownFirstItemType.None)]
88
private DropDownFirstItemType dropDownFirstItemType;
99

10-
// Note: DependencyProperty-SourceGenerator don't support "coerceValueCallback / isAnimationProhibited" correctly for now
11-
public static readonly DependencyProperty SelectedKeyProperty = DependencyProperty.Register(
12-
nameof(SelectedKey),
13-
typeof(string),
14-
typeof(LabelFontFamilySelector),
15-
new FrameworkPropertyMetadata(
16-
string.Empty,
17-
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
18-
OnSelectorLostFocus,
19-
coerceValueCallback: null,
20-
isAnimationProhibited: true,
21-
UpdateSourceTrigger.LostFocus));
22-
23-
// Note: DependencyProperty-SourceGenerator don't support "coerceValueCallback / isAnimationProhibited" correctly for now
24-
public string SelectedKey
25-
{
26-
get => (string)GetValue(SelectedKeyProperty);
27-
set => SetValue(SelectedKeyProperty, value);
28-
}
10+
[DependencyProperty(
11+
DefaultValue = "",
12+
Flags = FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
13+
PropertyChangedCallback = nameof(OnSelectorLostFocus),
14+
IsAnimationProhibited = true,
15+
DefaultUpdateSourceTrigger = UpdateSourceTrigger.LostFocus)]
16+
private string selectedKey;
2917

3018
public event EventHandler<ValueChangedEventArgs<string?>>? SelectorChanged;
3119

src/Atc.Wpf.Controls/LabelControls/Selectors/LabelLanguageSelector.xaml.cs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,13 @@ public partial class LabelLanguageSelector : ILabelLanguageSelector
1717
[DependencyProperty(DefaultValue = "")]
1818
private string defaultCultureIdentifier;
1919

20-
// Note: DependencyProperty-SourceGenerator don't support "coerceValueCallback / isAnimationProhibited" correctly for now
21-
public static readonly DependencyProperty SelectedKeyProperty = DependencyProperty.Register(
22-
nameof(SelectedKey),
23-
typeof(string),
24-
typeof(LabelLanguageSelector),
25-
new FrameworkPropertyMetadata(
26-
string.Empty,
27-
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
28-
OnSelectorLostFocus,
29-
coerceValueCallback: null,
30-
isAnimationProhibited: true,
31-
defaultUpdateSourceTrigger: UpdateSourceTrigger.LostFocus));
32-
33-
// Note: DependencyProperty-SourceGenerator don't support "coerceValueCallback / isAnimationProhibited" correctly for now
34-
public string SelectedKey
35-
{
36-
get => (string)GetValue(SelectedKeyProperty);
37-
set => SetValue(SelectedKeyProperty, value);
38-
}
20+
[DependencyProperty(
21+
DefaultValue = "",
22+
Flags = FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
23+
PropertyChangedCallback = nameof(OnSelectorLostFocus),
24+
IsAnimationProhibited = true,
25+
DefaultUpdateSourceTrigger = UpdateSourceTrigger.LostFocus)]
26+
private string selectedKey;
3927

4028
[DependencyProperty(DefaultValue = true)]
4129
private bool updateUiCultureOnChangeEvent;

src/Atc.Wpf.Controls/LabelControls/Selectors/LabelWellKnownColorSelector.xaml.cs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,13 @@ public partial class LabelWellKnownColorSelector : ILabelWellKnownColorSelector
2222
[DependencyProperty(DefaultValue = "")]
2323
private string defaultColorName;
2424

25-
// Note: DependencyProperty-SourceGenerator don't support "coerceValueCallback / isAnimationProhibited" correctly for now
26-
public static readonly DependencyProperty SelectedKeyProperty = DependencyProperty.Register(
27-
nameof(SelectedKey),
28-
typeof(string),
29-
typeof(LabelWellKnownColorSelector),
30-
new FrameworkPropertyMetadata(
31-
defaultValue: string.Empty,
32-
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
33-
OnSelectedKeyLostFocus,
34-
coerceValueCallback: null,
35-
isAnimationProhibited: true,
36-
UpdateSourceTrigger.LostFocus));
37-
38-
// Note: DependencyProperty-SourceGenerator don't support "coerceValueCallback / isAnimationProhibited" correctly for now
39-
public string SelectedKey
40-
{
41-
get => (string)GetValue(SelectedKeyProperty);
42-
set => SetValue(SelectedKeyProperty, value);
43-
}
25+
[DependencyProperty(
26+
DefaultValue = "",
27+
Flags = FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
28+
PropertyChangedCallback = nameof(OnSelectedKeyLostFocus),
29+
IsAnimationProhibited = true,
30+
DefaultUpdateSourceTrigger = UpdateSourceTrigger.LostFocus)]
31+
private string selectedKey;
4432

4533
public event EventHandler<ValueChangedEventArgs<string?>>? SelectorChanged;
4634

src/Atc.Wpf.Theming/Controls/Selectors/WellKnownColorSelector.xaml.cs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,13 @@ public partial class WellKnownColorSelector
2424
[DependencyProperty(DefaultValue = "")]
2525
private string defaultColorName;
2626

27-
// Note: DependencyProperty-SourceGenerator don't support "coerceValueCallback / isAnimationProhibited" correctly for now
28-
public static readonly DependencyProperty SelectedKeyProperty = DependencyProperty.Register(
29-
nameof(SelectedKey),
30-
typeof(string),
31-
typeof(WellKnownColorSelector),
32-
new PropertyMetadata(
33-
string.Empty,
34-
OnSelectedKeyChanged));
35-
36-
// Note: DependencyProperty-SourceGenerator don't support "coerceValueCallback / isAnimationProhibited" correctly for now
37-
public string SelectedKey
38-
{
39-
get => (string)GetValue(SelectedKeyProperty);
40-
set => SetValue(SelectedKeyProperty, value);
41-
}
27+
[DependencyProperty(
28+
DefaultValue = "",
29+
Flags = FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.Journal,
30+
PropertyChangedCallback = nameof(OnSelectedKeyChanged),
31+
IsAnimationProhibited = true,
32+
DefaultUpdateSourceTrigger = UpdateSourceTrigger.LostFocus)]
33+
private string selectedKey;
4234

4335
public event EventHandler<ValueChangedEventArgs<string?>>? SelectorChanged;
4436

src/Atc.Wpf/Atc.Wpf.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,8 +1014,8 @@
10141014

10151015
<ItemGroup>
10161016
<PackageReference Include="Atc" Version="2.0.552" />
1017-
<PackageReference Include="Atc.XamlToolkit" Version="1.5.34" />
1018-
<PackageReference Include="Atc.XamlToolkit.Wpf" Version="1.5.34" />
1017+
<PackageReference Include="Atc.XamlToolkit" Version="1.5.36" />
1018+
<PackageReference Include="Atc.XamlToolkit.Wpf" Version="1.5.36" />
10191019
</ItemGroup>
10201020

10211021
<ItemGroup>

0 commit comments

Comments
 (0)