1.作用:可以将源数据和目标数据之间进行特定的转化, 2.定义转换器,需要继承接口IValueConverter [ValueConversion(typeof(int), typeof(string))] public class ForeColorConverter : IValueConverter { //源属性传给目标属性时,调用此方法ConvertBack public object Convert(object value, Type targetType, object para
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value is DateTime) { DateTime test = (DateTime) value; string date = test.ToString("d/M/yyyy"); return date; } return string.E
首先在xaml中创建集合是一个不可取的方法. 本方法仅作为xaml的学习. 本文略微无聊,主要是编写的东西都是老玩意. 首先是定义一个类,作为你要加载集合的模型. 结构如下 internal class Student { public string Name { get; set; } public int Age { get; set; } } internal class StudentList:List<Student> { } class StringCollect { public