Agostino S.
Agostino S.

Reputation: 1

Create a mirror of a Usercontrol with FlyleafSharedOverlay in another window

I have a Usercontrol that contains a FlyleafSharedOverlay of FlyleafLib. This control is placed in a main window and fills the entire window area. This is the usercontrol

<UserControl x:Class="Streaming_Manager.MosaicControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:fl="clr-namespace:FlyleafLib.Controls.WPF;assembly=FlyleafLib"
        xmlns:local="clr-namespace:Streaming_Manager">
    <fl:FlyleafSharedOverlay Name="main_host">
        <fl:FlyleafSharedOverlay.DetachedContent>
            <Canvas x:Name="detached_canvas" Background="Black" AllowDrop="True">
                    <!--here the video players-->
            </Canvas>
        </fl:FlyleafSharedOverlay.DetachedContent>
        <Viewbox Name="viewbox_mc">
            <Grid x:Name="grid_controls">
                <Canvas Name="MosaicCanvas" Background="Transparent" Panel.ZIndex="0">
                    <!--here other usercontrols-->
                </Canvas>
                <local:TextMask x:Name="text_mask" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Panel.ZIndex="1" Visibility="Collapsed"/>
                <Image HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Stretch="Fill" x:Name="Image_shape" Panel.ZIndex="2" Visibility="Collapsed"/>
            </Grid>
        </Viewbox>
    </fl:FlyleafSharedOverlay>
</UserControl>

I want to create a mirror of the main window in another window.

I tried with the following code in the mirror window

<Window x:Class="Streaming_Manager.Mirror"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Mirror" Width="700" Height="200" 
        WindowStyle="None" 
        ResizeMode="CanResizeWithGrip"
        AllowsTransparency="True"
        ShowInTaskbar="False"
        WindowStartupLocation="Manual"
        BorderBrush="#FFFF0404" 
        BorderThickness="2" 
        MouseLeftButtonDown="Window_MouseLeftButtonDown" MouseMove="Window_MouseMove">
        <Rectangle x:Name="mirror_grid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Rectangle.Fill>
                <VisualBrush x:Name="mirror_visual" Stretch="Fill" Visual="{Binding}" TileMode="None"></VisualBrush>
            </Rectangle.Fill>
        </Rectangle>
</Window>

and in the .cs assign at the DataContext the main window. If I assign to Datacontext any other window the mirror works, but if I assign the main window it doesn't work. So I think it depends on whether the FlyleafSharedOverlay is used.

Any suggestion please?

Upvotes: 0

Views: 45

Answers (0)

Related Questions