99- ⚡ ** AOT-compatible** — An Incremental Roslyn Source Generator (` AutoSettingUI.Generator ` ) generates a reflection-free ` ISettingDescriptorProvider ` + ` IPropertyValueAccessor ` at compile time, enabling full Native AOT and trimming support.
1010- 🔌 ** Extensible** — Inject your own ` ISettingDescriptorProvider ` or ` IPropertyValueAccessor ` to override the defaults.
1111- 🧭 ** Built-in navigation** — Sections are listed in a sidebar tree; clicking navigates directly to the section.
12+ - 🎯 ** Extended Controls** — Built-in support for ColorPicker, DatePicker, TimePicker, NumericUpDown, and more.
13+
14+ ## Installation
15+
16+ Install the package for your preferred UI framework:
17+
18+ ``` xml
19+ <!-- Avalonia -->
20+ <PackageReference Include =" AutoSettingUI.Avalonia" Version =" 1.0.0" />
21+
22+ <!-- Ursa (Avalonia with Ursa theme) -->
23+ <PackageReference Include =" AutoSettingUI.Ursa" Version =" 1.0.0" />
24+
25+ <!-- WPF -->
26+ <PackageReference Include =" AutoSettingUI.WPF" Version =" 1.0.0" />
27+ ```
28+
29+ > ** Note:** ` AutoSettingUI.Core ` and ` AutoSettingUI.Generator ` are automatically included as dependencies.
1230
1331## Quick Start
1432
33+ ### 1. Define Your Settings Class
34+
1535``` csharp
36+ using AutoSettingUI .Core .Attributes ;
37+
1638[SettingUI (Category = " General" , Order = 0 )]
39+ [MainHeader (" Application Settings" )]
1740public class AppSettings
1841{
1942 [Title (" App Name" )]
@@ -24,32 +47,177 @@ public class AppSettings
2447
2548 [Title (" Volume" ), Range (0 , 100 )]
2649 public int Volume { get ; set ; } = 50 ;
50+
51+ [Title (" Language" )]
52+ [ItemsSource (typeof (AppSettings ), nameof (AvailableLanguages ))]
53+ public string Language { get ; set ; } = " en-US" ;
54+
55+ public static string [] AvailableLanguages => [" en-US" , " zh-CN" , " ja-JP" ];
2756}
2857```
2958
59+ ### 2. Add the Panel to Your UI
60+
61+ #### Avalonia
62+
63+ ``` xml
64+ <Window xmlns : auto =" clr-namespace:AutoSettingUI.Avalonia.Controls;assembly=AutoSettingUI.Avalonia" >
65+ <auto : AvaloniaAutoSettingPanel
66+ Title =" Settings"
67+ Targets =" {Binding SettingsList}"
68+ ShowNavigation =" True" />
69+ </Window >
70+ ```
71+
72+ #### Ursa
73+
3074``` xml
31- <!-- Avalonia -->
32- <avalonia : AvaloniaAutoSettingPanel
33- Targets =" {Binding Settings}"
34- Title =" Application Settings" />
75+ <Window xmlns : ursa =" clr-namespace:AutoSettingUI.Ursa.Controls;assembly=AutoSettingUI.Ursa" >
76+ <ursa : UrsaAutoSettingPanel
77+ Title =" Settings"
78+ Targets =" {Binding SettingsList}"
79+ UseCardBorderTheme =" True" />
80+ </Window >
3581```
3682
37- The source generator will automatically create ` GeneratedSettingProvider ` in your project. Pass it in for full AOT:
83+ #### WPF
84+
85+ ``` xml
86+ <Window xmlns : auto =" clr-namespace:AutoSettingUI.WPF.Controls;assembly=AutoSettingUI.WPF" >
87+ <auto : WpfAutoSettingPanel
88+ Title =" Settings"
89+ Targets =" {Binding SettingsList}"
90+ ShowNavigation =" True" />
91+ </Window >
92+ ```
93+
94+ ### 3. AOT Support (Optional)
95+
96+ For Native AOT or trimming support, use the generated provider:
3897
3998``` csharp
99+ // The source generator creates this class automatically
40100panel .DescriptorProvider = new AutoSettingUI .Generated .GeneratedSettingProvider ();
41- panel .PropertyAccessor = new AutoSettingUI .Generated .GeneratedSettingProvider ();
101+ panel .PropertyAccessor = new AutoSettingUI .Generated .GeneratedSettingProvider ();
102+ ```
103+
104+ ## Extended Controls
105+
106+ AutoSettingUI provides extended control attributes for specialized inputs:
107+
108+ ### ColorPicker (Avalonia/Ursa)
109+
110+ > ** Important:** ColorPicker requires additional style reference in ` App.axaml ` :
111+
112+ ``` xml
113+ <Application .Styles>
114+ <FluentTheme />
115+ <StyleInclude Source =" avares://Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml" />
116+ </Application .Styles>
117+ ```
118+
119+ Usage:
120+
121+ ``` csharp
122+ using Avalonia .Media ;
123+ using AutoSettingUI .Avalonia .Attributes ; // or AutoSettingUI.Ursa.Attributes
124+
125+ [SettingUI ]
126+ public class ThemeSettings
127+ {
128+ [Title (" Accent Color" )]
129+ [ColorPicker ]
130+ public Color AccentColor { get ; set ; } = Colors .DodgerBlue ;
131+ }
132+ ```
133+
134+ ### Other Extended Controls
135+
136+ | Attribute | Framework | Description |
137+ | ------------------ | --------- | ------------------------------------ |
138+ | ` [CheckBox] ` | All | Boolean property as CheckBox |
139+ | ` [DatePicker] ` | All | DateTime with date picker |
140+ | ` [TimePicker] ` | All | TimeSpan with time picker |
141+ | ` [NumericUpDown] ` | Avalonia | Numeric input with up/down buttons |
142+ | ` [ColorPicker] ` | Avalonia | Color selection |
143+ | ` [TagInput] ` | Ursa | String collection as tags |
144+ | ` [IPv4Box] ` | Ursa | IP address input |
145+
146+ ## Available Attributes
147+
148+ | Attribute | Target | Description |
149+ | ------------------ | --------- | ------------------------------------------ |
150+ | ` [SettingUI] ` | Class | Marks class for UI generation |
151+ | ` [MainHeader] ` | Class | Sets section header title |
152+ | ` [Title] ` | Property | Sets property label |
153+ | ` [SubHeader] ` | Property | Creates a sub-section |
154+ | ` [Hide] ` | Property | Excludes from UI |
155+ | ` [Range] ` | Property | Numeric range (renders slider) |
156+ | ` [ItemsSource] ` | Property | Dropdown items source |
157+ | ` [ControlBinding] ` | Property | Custom control binding |
158+ | ` [ReadOnly] ` | Property | Makes property read-only |
159+ | ` [Password] ` | Property | Masks input (password box) |
160+ | ` [Placeholder] ` | Property | Placeholder text for input |
161+ | ` [Layout] ` | Property | Custom layout (width, height) |
162+ | ` [Validation] ` | Property | Custom validation method |
163+
164+ ## Custom Control Binding
165+
166+ Create custom control attributes by inheriting from ` ControlBindingAttribute ` :
167+
168+ ``` csharp
169+ [AttributeUsage (AttributeTargets .Property )]
170+ public sealed class DatePickerAttribute : ControlBindingAttribute
171+ {
172+ public DatePickerAttribute ()
173+ : base (typeof (CalendarDatePicker ), " SelectedDate" )
174+ {
175+ }
176+ }
177+ ```
178+
179+ For complex controls, use factory methods:
180+
181+ ``` csharp
182+ public sealed class NumericUpDownAttribute : ControlBindingAttribute
183+ {
184+ public double Minimum { get ; set ; } = 0 ;
185+ public double Maximum { get ; set ; } = 100 ;
186+
187+ public NumericUpDownAttribute ()
188+ : base (typeof (NumericUpDown ), " Value" , nameof (CreateControl ))
189+ {
190+ }
191+
192+ public Control CreateControl (Type propertyType )
193+ {
194+ return new NumericUpDown
195+ {
196+ Minimum = (decimal )Minimum ,
197+ Maximum = (decimal )Maximum
198+ };
199+ }
200+ }
42201```
43202
44203## Packages
45204
46- | Package | Description |
47- | ------------------------- | ----------------------------------------------- |
48- | ` AutoSettingUI.Core ` | Attributes, interfaces, and models. |
49- | ` AutoSettingUI.Generator ` | Roslyn Incremental Source Generator (Analyzer). |
50- | ` AutoSettingUI.Avalonia ` | Avalonia UI panel extension. |
51- | ` AutoSettingUI.Ursa ` | Ursa-themed Avalonia panel extension. |
52- | ` AutoSettingUI.WPF ` | WPF panel extension. |
205+ | Package | Description |
206+ | ---------------------------- | ----------------------------------------------- |
207+ | ` AutoSettingUI.Core ` | Attributes, interfaces, and models. |
208+ | ` AutoSettingUI.Generator ` | Roslyn Incremental Source Generator (Analyzer). |
209+ | ` AutoSettingUI.Extension.Shared ` | Shared validation and control helpers. |
210+ | ` AutoSettingUI.Avalonia ` | Avalonia UI panel extension. |
211+ | ` AutoSettingUI.Ursa ` | Ursa-themed Avalonia panel extension. |
212+ | ` AutoSettingUI.WPF ` | WPF panel extension. |
213+
214+ ## Documentation
215+
216+ - [ Architecture] ( manual/architecture.md ) — Project structure and data flow
217+ - [ Attributes Reference] ( manual/attributes.md ) — All available attributes
218+ - [ Framework Extensions] ( manual/extensions.md ) — Framework-specific usage
219+ - [ AOT Source Generator] ( manual/aot-source-generator.md ) — AOT support details
220+
53221
54222## License
55223
0 commit comments