protected override void OnLoad() { base.OnLoad(); _comboBoxButton = new CheckComboBoxButton() { Width = 150, }; _comboBoxButton.CreateControlForItem += (o) => { var caption = o.ToString(); if (o is Item item) { caption = item.DisplayName; } return(new TextBlock() { Text = caption, Font = "Tahoma14Bold", Foreground = Color.Yellow, Shadow = Color.Black, }); }; var sources = _itemsSource.GetValues(); foreach (var item in sources) { _comboBoxButton.Items.Add(item); } var parent = _parent = this.GetAncestors().OfType <PropertyFrame>().FirstOrDefault(); if (parent != null) { var propertyInfo = parent.PropertyInfo; var source = parent.Source; var propValue = propertyInfo.GetValue(source); if (propValue is IList values) { foreach (var value in values) { var item = sources.FirstOrDefault(i => i.Value == value); if (item != null) { _comboBoxButton.SelectedItems.Add(item); } } } if (propValue is Direction dir) { var item = sources.FirstOrDefault(i => (Direction)i.Value == dir); if (item != null) { _comboBoxButton.SelectedItems.Add(item); } } } Children.Add(_comboBoxButton); _comboBoxButton.SelectedItems.CollectionChanged += Update; }