GeekPeek
GeekPeek

Reputation: 1767

How to add canvas programmatically?

I have a noob question =P How can I programatically add a canvas to a grid? When I use

 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 } }
        };

and then say LayoutRoot.Children.Add( _canvas );

nothing happens. What should I do?

Upvotes: 0

Views: 692

Answers (1)

Ku6opr
Ku6opr

Reputation: 8126

Alpha parameter is also 0 - 255, not 0.0 - 1.0

Upvotes: 5

Related Questions