It's trivial to generate a border (to use for Trackball events) transparent over the viewport in the XAML file:
<Border Name="myElement" Background="Transparent" />
But how do I do it in the .cs?
Border border = new Border();
**border.Background = (VisualBrush)Colors.Transparent;**
grid.Children.Add(viewport);
grid.Children.Add(border);
This does not work of course.
This is because you can't just cast a Color to be a Brush. use the Transparent brush instead
border.Background = Brushes.Transparent;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With