-
March 25th, 2014, 07:01 AM
#1
Image size inside a canvas control
I'm using VS 2010 Professional, Net 4.5.5...
I put a canvas in my window and I put an image in the canvas. I have the inage set to the canvas top and canvas left and I set the image with Height and Width Auto, VerticalAlignment and HorizontalAlignment = Stretch. MaxHeight and MaxWidth=Infinity.
When I run the program the image shows in the upper left corner and only covers about 1/3 of the area. Should I use something other than a canvas? I tried with just making the image the background of the window, but I couldn't figure out how to do that.
Code:
<Window x:Class="WorldClock.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WorldClock"
xmlns:sys="clr-name Title=SunSpot"
Title="MainWindow"
Name="TopWIndow"
WindowStartupLocation="CenterScreen"
WindowState="Maximized">
<Window.Resources>
<local:UpdateTime x:Key="newTime"/>
<Style x:Key="TimeFormat" TargetType="Label">
<Setter Property="FontFamily" Value="Century" />
<Setter Property="FontSize" Value="10" />
</Style>
</Window.Resources>
<Canvas Name="MainCanvas" >
<Image Canvas.Left="0" Canvas.Top="0" Name="World"
Source="/WorldClock;component/National-Geographic-World-Map.gif" />
</Canvas>
</Window>
While the settings don't show up in the xaml I did set them in the Properties. I deleted the automatic en tries for height and width that appeared in the Image control above because they were set to fixed values.
Thanks.
Scott
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|