I am trying to figure out how to get the “View Size” of the image that is set as the background in the Canvas control. The background is set using ImageBrush , with strech installed in UniForm.
If the strech property was set to Fill, then I could just use ActualWidth and ActualHeight on the canvas.
This is not possible in UniForm, so how should I approach this?
Here is my XAML:
<Grid DataContext="{Binding ImageViewerVM.CurrentImage}"> <controls:RubberBandingCanvas x:Name="RubCanvas"> <controls:RubberBandingCanvas.Resources> <Converters:ControlVisibilityConverter x:Key="VisibilityHiddenConverter" /> <Converters:StringToBitmapConverter x:Key="StringToBitmapConverter" /> </controls:RubberBandingCanvas.Resources> <controls:RubberBandingCanvas.Background> <ImageBrush x:Name="ibCurrentImage" ImageSource="{Binding Path=Path, Converter={StaticResource StringToBitmapConverter}}" Stretch="Uniform"></ImageBrush> </controls:RubberBandingCanvas.Background> <Ellipse Canvas.Top="10" Canvas.Right="10" Fill="Red" Stroke="Black" Height="15" Width="15" Visibility="{Binding Path=IsMultiTiff, Converter={StaticResource VisibilityHiddenConverter}}"/> </controls:RubberBandingCanvas> </Grid>
Yours faithfully,
Jesper Jensen
source share