Skip to content

Instantly share code, notes, and snippets.

@juanpaexpedite
Created November 3, 2017 19:51
Show Gist options
  • Save juanpaexpedite/14c3ce90bba9f30f3fbeee591640846f to your computer and use it in GitHub Desktop.
Save juanpaexpedite/14c3ce90bba9f30f3fbeee591640846f to your computer and use it in GitHub Desktop.
WPFConverterBinding2_2
<!--Remember to RaisePropertyChanged the ZIndex when Size Changes in the Model-->
<!-- And the viewmodel is defined like the following:
<Application.Resources>
<vm:PackViewModel x:Key="PackViewModel"/>
...
-->
<Grid Opacity="0.7" SnapsToDevicePixels="False" x:Name="ObjectZIndex" Visibility="{Binding IsZIndexSelector, Converter={StaticResource BoolVisibilityConverter}}" VerticalAlignment="Top" HorizontalAlignment="Left" Background="Transparent" Width="{Binding ElementName=BackPanel, Path=ActualWidth}" Height="1" RenderTransformOrigin="0,0">
<Grid.Resources>
<cvt:ZIndexConverter x:Key="ZIndexConverter" Size="{Binding Source={StaticResource PackViewModel}, Path=Thing.Size}"/>
</Grid.Resources>
<Grid.RenderTransform>
<TranslateTransform Y="{Binding Thing.ZIndex, Converter={StaticResource ZIndexConverter}}">
</TranslateTransform>
</Grid.RenderTransform>
<Rectangle Height="1" SnapsToDevicePixels="False" Fill="Red" StrokeThickness="0" RenderOptions.BitmapScalingMode="NearestNeighbor" VerticalAlignment="Top" HorizontalAlignment="Stretch"/>
</Grid>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment