diff --git a/MainWindow.xaml b/MainWindow.xaml
index 9ee9d29..0501d22 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -166,20 +166,42 @@
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/ObjetosSim/SensoresComandos/ucSensTemperatura.xaml.cs b/ObjetosSim/SensoresComandos/ucSensTemperatura.xaml.cs
index ddfd6b2..f981465 100644
--- a/ObjetosSim/SensoresComandos/ucSensTemperatura.xaml.cs
+++ b/ObjetosSim/SensoresComandos/ucSensTemperatura.xaml.cs
@@ -31,8 +31,7 @@ namespace CtrEditor.ObjetosSim
public float min_OUT_Scaled;
[ObservableProperty]
public float max_OUT_Scaled;
-
- [TypeConverter(typeof(FloatToStringConverter))]
+
[ObservableProperty]
public float value;
diff --git a/ObjetosSim/UserControlFactory.cs b/ObjetosSim/UserControlFactory.cs
index 697da15..28a5158 100644
--- a/ObjetosSim/UserControlFactory.cs
+++ b/ObjetosSim/UserControlFactory.cs
@@ -94,37 +94,6 @@ namespace CtrEditor.ObjetosSim
.Cast()
.Where(prop => !prop.Attributes.OfType().Any());
-
- //// Create the DataTemplate for float and double editors
- //var doubleFactory = new FrameworkElementFactory(typeof(DoubleUpDown));
- //doubleFactory.SetValue(DoubleUpDown.FormatStringProperty, "F3");
- //doubleFactory.SetValue(DoubleUpDown.IncrementProperty, 0.001);
- //doubleFactory.SetValue(DoubleUpDown.MaximumProperty, 200000.599);
- //doubleFactory.SetBinding(DoubleUpDown.ValueProperty, new Binding("Value")
- //{
- // Mode = BindingMode.TwoWay,
- // UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
- //});
-
- //var doubleTemplate = new DataTemplate { VisualTree = doubleFactory };
-
- //// Add editor definitions for float and double
- //var floatEditorDefinition = new EditorDefinition
- //{
- // EditorTemplate = doubleTemplate,
- // TargetType = typeof(float)
- //};
-
- //var doubleEditorDefinition = new EditorDefinition
- //{
- // EditorTemplate = doubleTemplate,
- // TargetType = typeof(double)
- //};
-
- //propertyGrid.EditorDefinitions.Add(floatEditorDefinition);
- //propertyGrid.EditorDefinitions.Add(doubleEditorDefinition);
-
-
foreach (var property in properties)
{
var displayNameAttr = property.Attributes.OfType().FirstOrDefault();
diff --git a/ObjetosSim/osBase.cs b/ObjetosSim/osBase.cs
index 402f365..4f76524 100644
--- a/ObjetosSim/osBase.cs
+++ b/ObjetosSim/osBase.cs
@@ -54,7 +54,6 @@ namespace CtrEditor.ObjetosSim
}
}
- [TypeConverter(typeof(DoubleToStringConverter))]
public abstract partial class osBase : ObservableObject
{
public virtual string Nombre { get; set; } = "osBase";
diff --git a/XAMLhelpers.cs b/XAMLhelpers.cs
index f5e73d4..5b7deb3 100644
--- a/XAMLhelpers.cs
+++ b/XAMLhelpers.cs
@@ -101,47 +101,6 @@ namespace CtrEditor
DisplayName = displayName;
}
}
- public class DoubleToStringConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is double doubleValue)
- {
- return doubleValue.ToString("0.00", culture);
- }
- return value;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is string stringValue && double.TryParse(stringValue, NumberStyles.Float, culture, out double result))
- {
- return result;
- }
- return value;
- }
- }
-
- public class FloatToStringConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is float doubleValue)
- {
- return doubleValue.ToString("0.00", culture);
- }
- return value;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is string stringValue && float.TryParse(stringValue, NumberStyles.Float, culture, out float result))
- {
- return result;
- }
- return value;
- }
- }
public class StringToBrushConverter : IValueConverter
{
@@ -404,14 +363,15 @@ namespace CtrEditor
{
if (value is float floatValue)
{
- return floatValue.ToString("0.00", culture); // Formatear a dos decimales
+ var r = floatValue.ToString("0.00", culture).Replace('.', ','); // Formatear a dos decimales
+ return r;
}
return value; // Devolver el valor original si no es un float
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
- if (value is string stringValue && float.TryParse(stringValue, NumberStyles.Float, culture, out float result))
+ if (value is string stringValue && float.TryParse(stringValue.Replace(',', '.'), NumberStyles.Float, culture, out float result))
{
return result;
}