示例#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(Label label)
        {
            if (label == null)
            {
                return;
            }

            if (Selected != null)
            {
                Selected.Background      = BrushFromColourString(StyleConfig.Options.BackgroundColour);
                Selected.Foreground      = BrushFromColourString(StyleConfig.Options.TextColour);
                Selected.BorderThickness = new Thickness(StyleConfig.Options.BorderWidth);
            }
            Selected                 = label;
            Selected.Background      = BrushFromColourString(StyleConfig.Selection.BackgroundColour);
            Selected.Foreground      = BrushFromColourString(StyleConfig.Selection.TextColour);
            Selected.BorderThickness = new Thickness(StyleConfig.Selection.BorderWidth);
            Selected.BringIntoView();
        }