diff --git a/MainViewModel.cs b/MainViewModel.cs
index 4d9c303..bad6e71 100644
--- a/MainViewModel.cs
+++ b/MainViewModel.cs
@@ -1337,6 +1337,8 @@ namespace CtrEditor
// Mostrar como modeless (no modal)
libraryWindow.Show();
}
+
+
}
public class SimulationData
diff --git a/ObjetosSim/Estaticos/ucTransporteTTop.xaml.cs b/ObjetosSim/Estaticos/ucTransporteTTop.xaml.cs
index 092132f..2799823 100644
--- a/ObjetosSim/Estaticos/ucTransporteTTop.xaml.cs
+++ b/ObjetosSim/Estaticos/ucTransporteTTop.xaml.cs
@@ -105,6 +105,7 @@ namespace CtrEditor.ObjetosSim
[ObservableProperty]
[property: Category("Setup:")]
+ [property: Name("Coeficiente de Fricción")]
public float frictionCoefficient;
[ObservableProperty]
[property: Category("Setup:")]
diff --git a/ObjetosSim/TagEditorAttribute.cs b/ObjetosSim/TagEditorAttribute.cs
index baa3ce6..8ad8d52 100644
--- a/ObjetosSim/TagEditorAttribute.cs
+++ b/ObjetosSim/TagEditorAttribute.cs
@@ -1,3 +1,4 @@
+using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
@@ -12,9 +13,26 @@ namespace CtrEditor.ObjetosSim
///
/// Atributo para marcar propiedades que deben usar el editor de etiquetas
///
+ [AttributeUsage(AttributeTargets.Property)]
public class TagEditorAttribute : Attribute
{
- public TagEditorAttribute() { }
+ public Type? EditorType { get; }
+
+ public TagEditorAttribute(Type? editorType = null)
+ {
+ EditorType = editorType;
+ }
+ }
+
+ [AttributeUsage(AttributeTargets.Property)]
+ public class NameAttribute : Attribute
+ {
+ public string DisplayName { get; }
+
+ public NameAttribute(string displayName)
+ {
+ DisplayName = displayName ?? throw new ArgumentNullException(nameof(displayName));
+ }
}
///
diff --git a/ObjetosSim/UserControlFactory.cs b/ObjetosSim/UserControlFactory.cs
index 28bfc91..362e2d9 100644
--- a/ObjetosSim/UserControlFactory.cs
+++ b/ObjetosSim/UserControlFactory.cs
@@ -91,7 +91,7 @@ namespace CtrEditor.ObjetosSim
{
// Forzar la actualización de bindings pendientes antes de limpiar
ForzarActualizacionBindings(propertyGrid);
-
+
// Clear previous properties
propertyGrid.SelectedObject = null;
propertyGrid.PropertyDefinitions.Clear();
@@ -129,7 +129,7 @@ namespace CtrEditor.ObjetosSim
// Pequeña pausa para permitir que se procesen los eventos
System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(
- System.Windows.Threading.DispatcherPriority.Background,
+ System.Windows.Threading.DispatcherPriority.Background,
new Action(() => { }));
}
catch (Exception ex)
@@ -144,7 +144,7 @@ namespace CtrEditor.ObjetosSim
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
{
var child = VisualTreeHelper.GetChild(parent, i);
-
+
// Buscar TextBox, ComboBox, y otros controles de edición comunes
if (child is TextBox textBox)
{
@@ -163,7 +163,7 @@ namespace CtrEditor.ObjetosSim
var expression = checkBox.GetBindingExpression(CheckBox.IsCheckedProperty);
expression?.UpdateSource();
}
-
+
// Recursión para buscar en controles hijos
ForzarActualizacionControlesEditores(child);
}
@@ -173,7 +173,7 @@ namespace CtrEditor.ObjetosSim
{
// Forzar la actualización de bindings pendientes antes de cambiar el objeto
ForzarActualizacionBindings(propertyGrid);
-
+
// Limpia las propiedades previas
propertyGrid.SelectedObject = null;
propertyGrid.PropertyDefinitions.Clear();
@@ -190,12 +190,26 @@ namespace CtrEditor.ObjetosSim
continue;
var displayNameAttr = property.Attributes.OfType().FirstOrDefault();
+ var customNameAttr = property.Attributes.OfType().FirstOrDefault();
+
+ string displayName;
+ if (customNameAttr != null)
+ {
+ displayName = customNameAttr.DisplayName;
+ }
+ else if (displayNameAttr != null)
+ {
+ displayName = displayNameAttr.DisplayName;
+ }
+ else
+ {
+ displayName = property.Name.Replace("_", " ");
+ }
+
var propertyDefinition = new PropertyDefinition
{
TargetProperties = new[] { property.Name },
- DisplayName = displayNameAttr != null
- ? displayNameAttr.DisplayName
- : property.Name.Replace("_", " ")
+ DisplayName = displayName
};
// Aquí se añaden todas las propiedades; para "ImagePath" no se requiere