|
<Window x:Class="MdxWpfInteroperability.Example.InteroperabilityExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:MdxWpfInteroperability="clr-namespace:MdxWpfInteroperability;assembly=MdxWpfInteroperability"
Loaded="Window_Loaded"
Title="Interoperability example" Height="300" Width="600">
<Grid>
<Grid.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<Border x:Key="backgroundVisual"
Background="LightGreen"
Opacity="0.2"
Padding="10">
<TextBlock Text="MDX & WPF Interoperability"
Foreground="DarkGreen"
FontSize="32" />
</Border>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.Background>
<VisualBrush Visual="{StaticResource backgroundVisual}"
Viewport="0,0,0.33,0.2"
TileMode="Tile"/>
</Grid.Background>
<ToggleButton Name="optionsToggle"
Content="Options"
VerticalAlignment="Bottom"
HorizontalAlignment="Left" />
<Border HorizontalAlignment="Right"
BorderBrush="Green"
BorderThickness="2"
Background="DarkGreen"
TextElement.Foreground="LightGreen"
CornerRadius="5"
Padding="5">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Surface mouse position: " />
<TextBlock Name="surfaceMousePosition"
Text="Out of surface" />
</StackPanel>
</Border>
<Grid Grid.Row="1"
Opacity="{Binding Value, ElementName=opacitySlider}">
<Grid.LayoutTransform>
<RotateTransform Angle="{Binding Value, ElementName=rotationSlider}" />
</Grid.LayoutTransform>
<ScrollViewer
HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible">
<MdxWpfInteroperability:D3dHost x:Name="mdxHost"
D3dSurfaceMouseLeave="mdxHost_D3dSurfaceMouseLeave"
D3dSurfaceMouseMove="mdxHost_D3dSurfaceMouseMove"/>
</ScrollViewer>
</Grid>
<Border Grid.Row="1"
Visibility="{Binding IsChecked, ElementName=optionsToggle, Converter={StaticResource BooleanToVisibilityConverter}}"
BorderBrush="DarkCyan"
BorderThickness="2"
Background="DarkBlue"
TextElement.Foreground="Cyan"
CornerRadius="5"
Opacity="0.7"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<StackPanel Margin="5">
<DockPanel>
<TextBlock DockPanel.Dock="Left" Text="Opacity: " />
<TextBlock DockPanel.Dock="Right" Text=")" />
<TextBlock DockPanel.Dock="Right" Text="{Binding Value, ElementName=opacitySlider}" />
<TextBlock DockPanel.Dock="Right" Text=" (" />
<Slider x:Name="opacitySlider" Minimum="0" Maximum="1" Value="0.8"
HorizontalAlignment="Left"
Width="200"/>
</DockPanel>
<DockPanel>
<TextBlock DockPanel.Dock="Left" Text="Rotation: " />
<TextBlock DockPanel.Dock="Right" Text=")" />
<TextBlock DockPanel.Dock="Right" Text=" degrees" />
<TextBlock DockPanel.Dock="Right" Text="{Binding Value, ElementName=rotationSlider}" />
<TextBlock DockPanel.Dock="Right" Text=" (" />
<Slider x:Name="rotationSlider" Minimum="0" Maximum="360" Value="10"
HorizontalAlignment="Left"
Width="200"/>
</DockPanel>
<DockPanel>
<TextBlock DockPanel.Dock="Left" Text="Zoom: " />
<TextBlock DockPanel.Dock="Right" Text=")" />
<TextBlock DockPanel.Dock="Right" Text="{Binding Value, ElementName=zoomSlider}" />
<TextBlock DockPanel.Dock="Right" Text=" (" />
<Slider x:Name="zoomSlider" Minimum="0.05" Maximum="1" Value="0.5"
ValueChanged="zoomSlider_ValueChanged"
HorizontalAlignment="Left"
Width="200"/>
</DockPanel>
</StackPanel>
</Border>
</Grid>
</Window>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.