using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; namespace SWS.CAD.Converter { public class ExpandConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { // 假设我们基于某个布尔属性来决定是否展开 return (bool)value; // 直接返回布尔值,用于IsExpanded绑定 } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return (bool)value; //throw new NotImplementedException(); // 不需要实现反向转换 } } }