Tweak DisplayAttribute, don't disable text labels, PropertyGrid should be feature complete now.
This commit is contained in:
@@ -12,22 +12,25 @@ namespace Torch.Views
|
|||||||
public string Description;
|
public string Description;
|
||||||
public string ToolTip;
|
public string ToolTip;
|
||||||
public string GroupName;
|
public string GroupName;
|
||||||
public int? Order;
|
public int Order;
|
||||||
public bool? Enabled;
|
public bool Enabled = true;
|
||||||
public bool? Visible;
|
public bool Visible = true;
|
||||||
public bool? ReadOnly;
|
public bool ReadOnly = false;
|
||||||
|
|
||||||
public DisplayAttribute()
|
public DisplayAttribute()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public static implicit operator DisplayAttribute(System.ComponentModel.DataAnnotations.DisplayAttribute da)
|
public static implicit operator DisplayAttribute(System.ComponentModel.DataAnnotations.DisplayAttribute da)
|
||||||
{
|
{
|
||||||
|
if (da == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
return new DisplayAttribute()
|
return new DisplayAttribute()
|
||||||
{
|
{
|
||||||
Name = da.GetName(),
|
Name = da.GetName(),
|
||||||
Description = da.GetDescription(),
|
Description = da.GetDescription(),
|
||||||
GroupName = da.GetGroupName(),
|
GroupName = da.GetGroupName(),
|
||||||
Order = da.GetOrder()
|
Order = da.GetOrder() ?? 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -110,7 +110,7 @@ namespace Torch.Views
|
|||||||
|
|
||||||
c.Value.Sort((a, b) =>
|
c.Value.Sort((a, b) =>
|
||||||
{
|
{
|
||||||
var c1 = descriptors[a]?.Order?.CompareTo(descriptors[b]?.Order);
|
var c1 = descriptors[a]?.Order.CompareTo(descriptors[b]?.Order);
|
||||||
if (c1.HasValue && c1.Value != 0)
|
if (c1.HasValue && c1.Value != 0)
|
||||||
return c1.Value;
|
return c1.Value;
|
||||||
return string.Compare((descriptors[a]?.Name ?? a.Name), descriptors[b]?.Name ?? b.Name, StringComparison.Ordinal);
|
return string.Compare((descriptors[a]?.Name ?? a.Name), descriptors[b]?.Name ?? b.Name, StringComparison.Ordinal);
|
||||||
@@ -138,8 +138,8 @@ namespace Torch.Views
|
|||||||
text.Margin = new Thickness(3);
|
text.Margin = new Thickness(3);
|
||||||
text.Tag = $"{text.Text}: {descriptor?.Description}";
|
text.Tag = $"{text.Text}: {descriptor?.Description}";
|
||||||
text.IsMouseDirectlyOverChanged += Text_IsMouseDirectlyOverChanged;
|
text.IsMouseDirectlyOverChanged += Text_IsMouseDirectlyOverChanged;
|
||||||
if (descriptor?.Enabled == false)
|
//if (descriptor?.Enabled == false)
|
||||||
text.IsEnabled = false;
|
// text.IsEnabled = false;
|
||||||
grid.Children.Add(text);
|
grid.Children.Add(text);
|
||||||
|
|
||||||
FrameworkElement valueControl;
|
FrameworkElement valueControl;
|
||||||
|
Reference in New Issue
Block a user