public static DataTemplate GetIconTemplate(VKIconName iconName) { var resources = Application.Current.Resources; if (resources.ContainsKey(iconName.ToString())) { return((DataTemplate)resources[iconName.ToString()]); } return(null); }
private void DrawIcon(VKIconName name) { if (IconPresenter == null) { return; } string iconName = name.ToString(); if (Double.IsNaN(Width) || Double.IsNaN(Height)) { Regex regex = new Regex(@"Icon(\d*)"); MatchCollection matches = regex.Matches(iconName); if (matches.Count > 0) { string size = matches[0].Value.Substring(4); Width = Height = Double.Parse(size); } } IconPresenter.ContentTemplate = name == VKIconName.None ? null : (DataTemplate)Application.Current.Resources[iconName]; }