请问在WPF的界面上如何添加分割线呢?
请问在WPF的界面上如何添加分割线呢?
[解决办法]
- C# code
Rectangle rect = new Rectangle();rect.VerticalAlignment = VerticalAlignment.Top;rect.Height = 1;rect.Width = 300;rect.Height = 300;// 几种方式 你看下rect.Fill = Brushes.Red;rect.Fill = new SolidColorBrush() { Color = Colors.Red, Opacity = 0.8 };rect.SetValue(Rectangle.FillProperty, Brushes.Olive);rect.Fill = new LinearGradientBrush(){ StartPoint = new Point(0, 0), EndPoint = new Point(0, 1), GradientStops = new GradientStopCollection() { new GradientStop(Colors.Red, 0), new GradientStop(Colors.Blue, 1) }};Grid.SetRow(rect, 1);LayoutRoot.Children.Add(rect);