/// <summary> /// Selects a label; deselecting the previously selected label. /// </summary> /// <param name="label">The label to be selected. If this value is null, the selected label will not be changed.</param> protected void Select(SelectionLabel label) { if (label == null) { return; } if (Selected != null) { Selected.Background = styleConfig.Options.BackgroundColour; Selected.Foreground = styleConfig.Options.TextColour; Selected.LabelBorder.BorderBrush = styleConfig.Options.BorderColour; Selected.LabelBorder.BorderThickness = styleConfig.Options.BorderWidth; } Selected = label; Selected.Background = styleConfig.Selection.BackgroundColour; Selected.Foreground = styleConfig.Selection.TextColour; Selected.LabelBorder.BorderBrush = styleConfig.Selection.BorderColour; Selected.LabelBorder.BorderThickness = styleConfig.Selection.BorderWidth; }
protected SelectionLabel CreateLabel(string content) { var label = new SelectionLabel(content, styleConfig.Options, styleConfig.FontSize, new FontFamily(styleConfig.FontFamily)); label.MouseLeftButtonUp += (sender, args) => { if (label == Selected) { HandleSelect(); } else { Select(label); HandleSelectionChange(label); } // Return focus to the searchbox so the user can continue typing immediately. SearchBox.Focus(); }; return(label); }
protected virtual void HandleSelectionChange(SelectionLabel selection) { }
protected void AddLabel(SelectionLabel label) { Options.Add(label); OptionsPanel.Children.Add(label); }