static void Type_PropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) { ICONButton button = ((ICONButton)sender); if (button.m_Background_Active != null && button.m_Background_General != null && button.m_Background_Secondary != null) { SetVisualByButtonType(button, (ICONButtonType)args.NewValue); } else { button.m_typeInited = false; } }
static void SetVisualByButtonType(ICONButton button, ICONButtonType buttonType) { if (buttonType == ICONButtonType.Active) { button.m_Background_Active.Visibility = Visibility.Visible; button.m_Background_General.Visibility = Visibility.Collapsed; button.m_Background_Secondary.Visibility = Visibility.Collapsed; } else if (buttonType == ICONButtonType.Secondary) { button.m_Background_Active.Visibility = Visibility.Collapsed; button.m_Background_General.Visibility = Visibility.Collapsed; button.m_Background_Secondary.Visibility = Visibility.Visible; } else { button.m_Background_Active.Visibility = Visibility.Collapsed; button.m_Background_General.Visibility = Visibility.Visible; button.m_Background_Secondary.Visibility = Visibility.Collapsed; } }