2025-10-10 13:22:56 +08:00
|
|
|
|
using HandyControl.Controls;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Laservall.Solidworks.Common
|
|
|
|
|
|
{
|
|
|
|
|
|
public class ComboxPropertyEditor : PropertyEditorBase
|
|
|
|
|
|
{
|
|
|
|
|
|
public override FrameworkElement CreateElement(PropertyItem propertyItem)
|
|
|
|
|
|
{
|
|
|
|
|
|
var comboBox = new ComboBox();
|
|
|
|
|
|
comboBox.ItemsSource = new List<string> { "A", "B", "C" };
|
|
|
|
|
|
comboBox.SelectedItem = propertyItem.Value?.ToString();
|
|
|
|
|
|
comboBox.SelectionChanged += (s, e) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
propertyItem.Value = comboBox.SelectedItem;
|
|
|
|
|
|
};
|
|
|
|
|
|
return comboBox;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override DependencyProperty GetDependencyProperty()
|
|
|
|
|
|
{
|
|
|
|
|
|
return ComboBox.SelectedItemProperty;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-03-20 09:33:27 +08:00
|
|
|
|
|
|
|
|
|
|
public class CategoryComboxPropertyEditor : PropertyEditorBase
|
|
|
|
|
|
{
|
|
|
|
|
|
public override FrameworkElement CreateElement(PropertyItem propertyItem)
|
|
|
|
|
|
{
|
|
|
|
|
|
var comboBox = new ComboBox();
|
|
|
|
|
|
comboBox.ItemsSource = new List<string> { "A", "B", "C" };
|
|
|
|
|
|
comboBox.SelectedItem = propertyItem.Value?.ToString();
|
|
|
|
|
|
comboBox.SelectionChanged += (s, e) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
propertyItem.Value = comboBox.SelectedItem;
|
|
|
|
|
|
};
|
|
|
|
|
|
return comboBox;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override DependencyProperty GetDependencyProperty()
|
|
|
|
|
|
{
|
|
|
|
|
|
return ComboBox.SelectedItemProperty;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-10-10 13:22:56 +08:00
|
|
|
|
}
|