<UserControl x:Class="TDx.TestNL.Views.Viewport"
             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" 
             xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
             xmlns:vmUtils="clr-namespace:TDx.TestNL.ViewModels.Utils"
             mc:Ignorable="d" d:DesignWidth="274.237" d:DesignHeight="215.763"
             Loaded="UserControl_Loaded">

    <i:Interaction.Triggers>
        <i:EventTrigger EventName="SizeChanged">
            <vmUtils:InteractiveCommand Command="{Binding ViewportSizeChangedCommand}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>

    <Grid>
        <Viewport3D x:Name="viewport" Camera="{Binding Path=Camera.Camera}">
            <ModelVisual3D x:Name="ambientLight" Content="{Binding AmbientLight}" />
            <ModelVisual3D x:Name="directionalLight" Content="{Binding DirectionalLight}" />
            <ModelVisual3D x:Name="model" Content="{Binding Model}" />
        </Viewport3D>

        <Canvas Margin="{Binding PivotMargin}">
            <Image Source="pack://application:,,,/Images/3dx_pivot.png" Width="12" Height="13"
                   Visibility="{Binding Path=PivotVisible, Converter={StaticResource BoolToVisibility}}" />
        </Canvas>
    </Grid>
</UserControl>