Commit c65de1e1 authored by Jérémy VIGNELLES's avatar Jérémy VIGNELLES Committed by Martin Finkel

Simplified LVS.Wpf control by removing the XAML part

parent 9587b2cf
......@@ -2,34 +2,45 @@
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace LibVLCSharp.WPF
{
internal partial class ForegroundWindow : Window
internal class ForegroundWindow : Window
{
Window? _wndhost;
readonly FrameworkElement _bckgnd;
UIElement? _content;
readonly Point _zeroPoint = new Point(0, 0);
private readonly Grid _grid = new Grid();
internal new UIElement? Content
UIElement? _overlayContent;
internal UIElement? OverlayContent
{
get => _content;
get => _overlayContent;
set
{
_content = value;
PART_Content.Children.Clear();
if (_content != null)
_overlayContent = value;
_grid.Children.Clear();
if (_overlayContent != null)
{
PART_Content.Children.Add(_content);
_grid.Children.Add(_overlayContent);
}
}
}
internal ForegroundWindow(FrameworkElement background)
{
InitializeComponent();
Title = "LibVLCSharp.WPF";
Height = 300;
Width = 300;
WindowStyle = WindowStyle.None;
Background = Brushes.Transparent;
ResizeMode = ResizeMode.NoResize;
AllowsTransparency = true;
ShowInTaskbar = false;
Content = _grid;
DataContext = background.DataContext;
......
<Window x:Class="LibVLCSharp.WPF.ForegroundWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
x:ClassModifier="internal"
mc:Ignorable="d"
Title="LibVLCSharp.WPF" Height="300" Width="300" WindowStyle="None" Background="Transparent" ResizeMode="NoResize" AllowsTransparency="True" ShowInTaskbar="False">
<Grid x:Name="PART_Content" />
</Window>
......@@ -76,7 +76,7 @@ namespace LibVLCSharp.WPF
{
ForegroundWindow = new ForegroundWindow(windowsFormsHost)
{
Content = ViewContent
OverlayContent = ViewContent
};
}
......@@ -124,7 +124,7 @@ namespace LibVLCSharp.WPF
ViewContent = newContent as UIElement;
if (ForegroundWindow != null)
{
ForegroundWindow.Content = ViewContent;
ForegroundWindow.OverlayContent = ViewContent;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment