1
Theres a problem。每使用C#-Code一个字符串值,我不能设置BorderBrush(不XAML):如何从字符串中设置Border.BorderBrush
((Border)((Image)sender).Parent).BorderBrush = "#FFBCC7D8";
如何解决这个问题呢?
Theres a problem。每使用C#-Code一个字符串值,我不能设置BorderBrush(不XAML):如何从字符串中设置Border.BorderBrush
((Border)((Image)sender).Parent).BorderBrush = "#FFBCC7D8";
如何解决这个问题呢?
您必须使用Converter将字符串转换为画笔对象。在框架中有一个BrushConverter来做到这一点。
BrushConverter converter = new BrushConverter();
BorderBrush brush = converter.ConvertFromString("#FFBCC7D8") as Brush;
((Border)((Image)sender).Parent).BorderBrush = brush;