如何以编程方式添加画布?

时间:2012-01-18 16:09:23

标签: windows-phone-7

我有一个noob问题= P. 如何以编程方式将画布添加到网格?当我使用

 Canvas _canvas = new Canvas( )
        {
            Name = "newCanvas",
            Visibility = System.Windows.Visibility.Visible,
            Margin = new Thickness( 100, 0, 0, 100 ),
            Width = 100000,
            Height = 100000,
            Background = new SolidColorBrush { Color = new Color { R = 255, G = 255, B = 255, A = 1 } }
        };

然后说LayoutRoot.Children.Add( _canvas );

没有任何反应。我该怎么办?

1 个答案:

答案 0 :(得分:5)

Alpha参数也是0 - 255,而不是0.0 - 1.0