AcManager.Controls.AcObjectListBox.OnApplyTemplate C# (CSharp) Method

OnApplyTemplate() public method

public OnApplyTemplate ( ) : void
return void
        public override void OnApplyTemplate() {
            if (_listBox != null) {
                _listBox.SelectionChanged -= ListBox_SelectionChanged;
            }

            base.OnApplyTemplate();

            _listBox = GetTemplateChild(@"PART_ListBox") as ListBox;
            if (_listBox != null) {
                if (SelectionMode != SelectionMode.Single && InnerItemsSource != null) {
                    _listBox.SelectedItems.Clear();
                    _listBox.SelectedItems.Add(InnerItemsSource.CurrentItem);
                }

                _listBox.SelectionChanged += ListBox_SelectionChanged;
            }
        }