StrokeThickness etc

When I have the following, my Stretch Fill seems to work (lines are drawn within the stroke):

<Grid x:Name="LayoutRoot" >
<Polygon Points="10,0 100,0 90,50 0,50" Stroke="Black" StrokeThickness="1" Stretch="Fill" />
But when I add a SpotPanel the lines are 'cut' in half, because the Panel seems be be out of bounds or is misscalculating the Boundaries?
<Grid x:Name="LayoutRoot" >
<Polygon Points="10,0 100,0 90,50 0,50" Stroke="Black" StrokeThickness="1" Stretch="Fill" />
What to do to solve this?

When I try defining a UserControl containing exactly the XAML that you show, I don’t see any problems with the resulting parallelogram.

Are you seeing the same behavior at run-time that you do at design-time?

Another thought: I have VS2010 SP1 installed. I wonder if that might have fixed a VS designer bug related to what you are seeing.

I have installed the VS SP1 yesterday. I was thinking also that maybe that could solve it. The exact code of the UserControl is:

<br /><UserControl x:Class="Grade_Diagram.Shapes.ProcessShape" <br /> xmlns="" <br /> xmlns:x="" <br /> xmlns:d="" <br /> xmlns:mc="" <br /> xmlns:hlp="clr-namespace:Grade_Diagram.Helpers" <br /> xmlns:ctrls="clr-namespace:Grade_Diagram.Controls" <br /> xmlns:go="clr-namespace:Northwoods.GoXam;assembly=Northwoods.GoSilverlight" <br /> mc:Ignorable="d" <br /> Height="50" Width="100"> <br /> <UserControl.Resources> <br /> <ResourceDictionary x:Key="Headers" Source="../Assets/Styles.xaml" /> <br /> </UserControl.Resources> <br /> <Grid x:Name="LayoutRoot" > <br /> <go:SpotPanel > <br /> <Polygon Points="10,0 100,0 90,50 0,50" Stroke="Black" StrokeThickness="1" Stretch="Fill" /> <br /> </go:SpotPanel> <br /> </Grid> <br /></UserControl> <br />

With the SpotPanel I get that weird line behaviour, also runtime. Btw, we just (couple of minutes ago) bought the full version (incl. source), maybe this is newer as the one I have? We bought it because this is exactly what we needed :) And of course the great service.

As soon as I have the license key I can publish it on the web so you can see how it looks like in our environment.

You have version now, right?

Right, at the moment I am also installing and activating the licensed version.

I did a clean test. Started a new Silverlight Project

- Added the GoSilverlightProject Source to the Solution. (In the assembly info it says 1.2.2 btw)

- Added a reference in my silverlight project to this added project. Which now says on the referenced source version

- Added 1 new file (User Control)

<br /><UserControl x:Class="ShapeTest.Shape" <br /> xmlns="" <br /> xmlns:x="" <br /> xmlns:d="" <br /> xmlns:mc="" <br /> xmlns:go="clr-namespace:Northwoods.GoXam;assembly=Northwoods.GoSilverlight" <br /> mc:Ignorable="d" <br /> Height="50" Width="100"> <br /> <br /> <Grid x:Name="LayoutRoot" > <br /> <go:SpotPanel> <br /> <Polygon Points="10,0 100,0 90,50 0,50" Stroke="Black" StrokeThickness="1" Stretch="Fill" /> <br /> </go:SpotPanel> <br /> </Grid> <br /></UserControl> <br />

- Silverlight 4 (4.0.60129.0) and dev runtime updated

And still have the problem that the shape is ‘out-of-bounds’ drawn in VS and at runtime…Where did I go wrong?

Did you install GoSilverlight1224.msi or GoSilverlight1264.msi? The latter (…1264) is newer and has a number of bug fixes that 1224 does not have.

I installed 1264. But since yesterday I use the source from the project which tells me its version 1.2.2. (we bought your solution including source code).

Now that you have included the whole XAML file, I see the problem.
(Sorry I didn’t notice earlier.)

The Polygon has points that cover a geometrical width of 100 and a height of 50.

But the Polygon shape has a width of 101 and a height of 51 when you take the thickness of the stroke into account.

By specifying that the Width and Height of the whole UserControl are only 100 and 50, you are explicitly clipping the Polygon shape.

But when I leave the SpotPanel away it is not clipped. When I use the Stretch=“Fill” I thought the Line would be inside the Polygon ? I’m getting a little confused on this one.

The Stretch property doesn’t make any sense within a SpotPanel, because the main (first) element of the SpotPanel has to have a defined size.

The other elements of the SpotPanel are arranged relative to that main element.

The total size of the SpotPanel then becomes the size of the collective bounds of all of those elements. So the Stretch property is meaningless, I think.

I believe you can come up with a similar situation with a Polygon inside a StackPanel.

Ok, I’ll check my shapes tomorrow. Thanks for your explanation.