コード例 #1
0
        /// <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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 protected virtual void HandleSelectionChange(SelectionLabel selection)
 {
 }
コード例 #4
0
 protected void AddLabel(SelectionLabel label)
 {
     Options.Add(label);
     OptionsPanel.Children.Add(label);
 }