How do i put a border on my grid in WPF?

前端 未结 6 468
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 17:54

How do i put a border on my grid in C#/WPF?

This is what i would like it to be, but puts a border around the whole thing instead of the grid control i put in my appl

6条回答
  •  情深已故
    2020-12-02 18:35

    If someone is interested in the similar problem, but is not working with XAML, here's my solution:

    var B1 = new Border();
    B1.BorderBrush = Brushes.Black;
    B1.BorderThickness = new Thickness(0, 1, 0, 0); // You can specify here which borders do you want
    YourPanel.Children.Add(B1);
    

提交回复
热议问题