public override void OnApplyTemplate() {
base.OnApplyTemplate();
if (Popup != null) {
Popup.Opened -= Popup_Opened;
}
Popup = GetTemplateChild("PART_Popup") as Popup;
_panel = GetTemplateChild("PART_Panel") as ColorPickerPanel;
if (Popup != null) {
Popup.Opened += Popup_Opened;
}
}