Refactor PropertyGrid UI, converters, and solution setup
- Improved PropertyGrid.axaml formatting and control styles; ensured spinner buttons are always visible and ColorPicker layouts are flexible; disabled horizontal scrolling in property list. - Reformatted property editors and group/category display for clarity. - Made all value converters sealed, added XML docs, and updated ConvertBack to throw NotImplementedException where unsupported. - Enhanced search logic to use StringComparison.OrdinalIgnoreCase. - Minor code style fixes (e.g., char literals for string checks). - Removed default value assignment for _useProxy in AdvancedConfiguration.cs. - Updated Program.cs in examples to use sealed Program classes. - Added PropertyGrid.slnx to organize solution and projects.
This commit is contained in:
@@ -7,8 +7,16 @@ namespace Avalonia.PropertyGrid.Controls;
|
||||
/// <summary>
|
||||
/// Converts PropertyType to appropriate numeric format string
|
||||
/// </summary>
|
||||
public class NumericFormatConverter : IValueConverter
|
||||
public sealed class NumericFormatConverter : IValueConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a Type to an appropriate numeric format string.
|
||||
/// </summary>
|
||||
/// <param name="value">The Type to convert.</param>
|
||||
/// <param name="targetType">The target type.</param>
|
||||
/// <param name="parameter">Optional parameter.</param>
|
||||
/// <param name="culture">Culture information.</param>
|
||||
/// <returns>A format string like "N2" for floating point or "N0" for integers.</returns>
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is Type type)
|
||||
@@ -26,6 +34,15 @@ public class NumericFormatConverter : IValueConverter
|
||||
return "N0";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not supported for this converter.
|
||||
/// </summary>
|
||||
/// <param name="value">The value to convert back.</param>
|
||||
/// <param name="targetType">The target type.</param>
|
||||
/// <param name="parameter">Optional parameter.</param>
|
||||
/// <param name="culture">Culture information.</param>
|
||||
/// <returns>Throws NotImplementedException.</returns>
|
||||
/// <exception cref="NotImplementedException">This converter does not support ConvertBack.</exception>
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
Reference in New Issue
Block a user