Reputation: 18068
I would like to create a border over the WindowsFormsHost
. How to do so?
In .cs file:
WindowsFormsHost Host = new WindowsFormsHost();
and in the xaml:
<WindowsFormsHost x:Name="Host"></WindowsFormsHost>
Upvotes: 0
Views: 497
Reputation: 15941
Use the border class:
xaml:
<Border BorderThickness="1" BorderBrush="Green">
<WindowsFormsHost x:Name="Host"></WindowsFormsHost>
</Border>
cs:
var myBorder = new Border();
myBorder.BorderBrush = Brushes.Green;
myBorder.BorderThickness = new Thickness(1);
myBorder.Child = new WindowsFormsHost();
Upvotes: 1
Reputation: 32515
The System.Windows.Border
class is a type of Decorator
, which means it can have a single Child
element. In this case, your child would be the WindowsFormsHost
.
XAML:
<Border BorderBrush="Green" BorderThickness="1">
<WindowsFormsHost x:Name="Host"></WindowsFormsHost>
</Border>
Upvotes: 3