WynApse Home Page
Home    Blog    About    Contact       
Latest Article:

My Tags:
My Sponsors:

Lifetime Member:

<SilverlightTooltip Number="006" Text="Outer Canvas Width and Height" />

This Tooltip comes to you by way of me having to hack around trying to figure out why something as simple as the Width and Height of the outer canvas was not working.

Outer Canvas Dimension Designation

Early on, I figured out that I didn't need to put the Width and Height of the outer canvas in my XAML. Since I build as I go, this is an advantage, because most often I don't know how big it's going to be until I get done, and sometimes even after that... when I have to fix something :)

Being a big one for only having one place to go to change something, I chose to just drop the Width and Height from the outer canvas in the XAML. It's set in my createObjectEx call, so that's good enough.

When not Designating Dimensions in XAML is a Problem

I got through 28 Silverlight pages, 5 Tooltips, and 9 Tutorials before this jumped out and gnawed on my rear. In Tutorial 10, I initially had intended to include code to keep from moving objects outside the canvas. I ultimately decided to put that off until Tutorial 11, but the code is complete. While working on that code, I needed to know if I was off-canvas. Of couse using findName of the outer canvas and then Width or Height seemed the logical thing to do, but it was not working.

It took me longer than it should have to realize that those dimensions were not the dimensions in the running canvas, but were, instead, the dimensions of the canvas as designated in the XAML file, and once I added the Width and Height back into my XAML, things started working!

Thought that might come in handy for someone :)

Copyright © 2006-2022, WynApse