public override void OnApplyTemplate() {
if (_comboBox != null) {
_comboBox.ItemSelected -= ComboBox_SelectionChanged;
_comboBox.PreviewProvider = null;
}
_comboBox = GetTemplateChild(@"PART_ComboBox") as HierarchicalComboBox;
if (_comboBox != null) {
_comboBox.ItemSelected += ComboBox_SelectionChanged;
_comboBox.PreviewProvider = this;
}
base.OnApplyTemplate();
}