// Private members private void ApplyStyles(Button button, IRuleset rules) { button.FlatStyle = FlatStyle.Flat; double borderWidth = rules.Where(p => p.IsBorderWidthProperty()) .Cast <NumberProperty>() .Select(p => p.Value) .LastOrDefault(); Color borderColor = rules.Where(p => p.IsBorderColorProperty()) .Cast <ColorProperty>() .Select(p => p.Value) .LastOrDefault(); if (borderWidth > 0) { button.FlatAppearance.BorderColor = borderColor; button.FlatAppearance.BorderSize = (int)borderWidth; } }
private void ApplyStyles(ListBox listBox, IRuleset rules) { double borderWidth = rules.Where(p => p.IsBorderWidthProperty()) .Cast <NumberProperty>() .Select(p => p.Value) .LastOrDefault(); if (borderWidth <= 0) { listBox.BorderStyle = System.Windows.Forms.BorderStyle.None; } else { listBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; } }