//Convert是将kind类型转化为图片的Url public object Convert(object value, Type targetType, object parameter, string language) { Models.kind kind = (Models.kind)value; switch (kind) { case Models.kind.contact: return(UrlToImageSource("/Assets/contact.png")); case Models.kind.education: return(UrlToImageSource("/Assets/education.png")); case Models.kind.food: return(UrlToImageSource("/Assets/food.png")); case Models.kind.entertainment: return(UrlToImageSource("/Assets/fun.png")); case Models.kind.medical: return(UrlToImageSource("/Assets/medical.png")); case Models.kind.investment: return(UrlToImageSource("/Assets/money.png")); case Models.kind.other: return(UrlToImageSource("/Assets/other.png")); case Models.kind.shopping: return(UrlToImageSource("/Assets/shopping.png")); case Models.kind.traffic: return(UrlToImageSource("/Assets/traffic.png")); case Models.kind.travel: return(UrlToImageSource("/Assets/travel.png")); case Models.kind.bonus: return(UrlToImageSource("/Assets/bonus.png")); case Models.kind.salary: return(UrlToImageSource("/Assets/salary.png")); case Models.kind.welfare: return(UrlToImageSource("/Assets/welfare.png")); case Models.kind.financial: return(UrlToImageSource("/Assets/financial.png")); case Models.kind.otherincome: return(UrlToImageSource("/Assets/other.png")); default: return(UrlToImageSource("/Assets/other.png")); } }
private void button_Click(object sender, RoutedEventArgs e) { Border border; if (isclick != null) { border = isclick.Parent as Border; border.BorderBrush = new SolidColorBrush(Colors.LightGray); } Button button = sender as Button; isclick = button; border = button.Parent as Border; border.BorderBrush = new SolidColorBrush(Colors.Gray); source = button.Name; kind = dic[button.Name]; }