| 12345678910111213141516171819202122232425262728293031323334353637 | using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Data;namespace PunkHPX8_MainPages.Converters{   public class AllNoneCheckboxConverter : IMultiValueConverter    {        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)        {            bool result = (bool)values[0];            for (int i = 0; i < values.Length; i++)                if (result != (bool)values[i])                    return null;            return result;        }        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)        {            object[] result = new object[targetTypes.Length];            bool isChecked = (bool)value;            for (int i = 0; i < result.Length; i++)                if (isChecked)                    result[i] = true;                else                    result[i] = false;            return result;        }    }}
 |