I have a simple control with code to add some paths. When I add my control to the control canvas, nothing shows up. To make sure that I wasn't crazy, I debugged through the code, and created a XAML equivalent and placed it off to the side of where my control should be showing up. I've tried changing the z-index and various Top/Left combination's to try an get my paths to show but no luck. My controls are in the Canvas children collection, but they just don't want to turn up! Here's my code
for (int i = 0; i < 4; i++)
{
SolidColorBrush brush = new SolidColorBrush();
brush.Color = GetColor();
path = new Path();
path.Data = getData(i);
path.Name = i.ToString();
path.SetValue(Canvas.LeftProperty, 150.0);
path.SetValue(Canvas.TopProperty, 150.0);
path.SetValue(Canvas.ZIndexProperty, 1000);
path.Fill = brush;
mainLayout.Children.Add(path);
}
And heres the XAML. The paths hard coded in there are the paths I created by stepping through the code.
<Canvas Name="mainLayout">
<Path Name="Path5" Fill="Red" Canvas.Left="450" Canvas.Top="150" Data="M 0,-100 A 100,100 0.628332123128715 0 1 58.7796248729471,-80.9009004881628 L 0,0" ></Path>
<Path Name="Path6" Fill="Green" Canvas.Left="450" Canvas.Top="150" Data="M 58.7796248729471,-80.9009004881628 A 100,100 0.559576083957105 0 1 92.7589501245075,-37.3601013355041 L 0,0" ></Path>
<Path Name="Path7" Fill="Blue" Canvas.Left="450" Canvas.Top="150" Data="M 92.7589501245075,-37.3601013355041 A 100,100 3.11153310318617 0 1 -91.5941871397306,40.1310961999795 L 0,0" ></Path>
<Path Name="Path8" Fill="Yellow" Canvas.Left="450" Canvas.Top="150" Data="M -91.5941871397306,40.1310961999795 A 100,100 1.98374399690759 0 1 -1.1330996904646E-13,-100 L 0,0" ></Path>
</Canvas>
When I run everything, only the hard coded paths show up.