Columnas en Windows Phone 7

I read that I can use Silverlight Toolkit to make columns. But how can I do it with C# code, not with XAML? (in my class)

Por ejemplo:

<toolkit:WrapPanel Orientation="Vertical" Height="400">
<Button Content="A" BorderBrush="Aqua" />
<Button Content="B" BorderBrush="CadetBlue" />
<Button Content="C" BorderBrush="DarkMagenta" />
<Button Content="D" BorderBrush="Fuchsia" />
<Button Content="F" BorderBrush="LightBlue" />
<Button Content="G" BorderBrush="Orange" />
</toolkit:WrapPanel>

But how can I do it with C# function?

preguntado el 09 de marzo de 12 a las 15:03

Column of what? You should draw some UI example and add a picture to your question cause right now we have no idea about what you actually want. -

1 Respuestas

Here's how you write the same thing in C#

var wp = new WrapPanel
    {
        Orientation = System.Windows.Controls.Orientation.Vertical,
        Height = 400
    };

wp.Children.Add(new Button { Content = "A", BorderBrush = new SolidColorBrush(Colors.Cyan) }); // Cyan is the same as Aqua
wp.Children.Add(new Button { Content = "B", BorderBrush = new SolidColorBrush(Color.FromArgb(255, 95, 158, 160)) }); // CadetBlue
wp.Children.Add(new Button { Content = "C", BorderBrush = new SolidColorBrush(Color.FromArgb(255, 139, 0, 139)) }); // DarkMagenta
wp.Children.Add(new Button { Content = "D", BorderBrush = new SolidColorBrush(Colors.Magenta) }); // Fuschia is the same as Magenta
wp.Children.Add(new Button { Content = "F", BorderBrush = new SolidColorBrush(Color.FromArgb(255, 173, 216, 230)) }); // LightBlue
wp.Children.Add(new Button { Content = "G", BorderBrush = new SolidColorBrush(Colors.Orange) });

this.LayoutRoot.Children.Add(wp);

respondido 09 mar '12, 16:03

Thank you! But the is another question: what can I do to add "wp", if "LayoutRoot" doesn't definite? - Max Zhukov

Since you're in a PhoneApplicationPage class (MainPage), you can set the Content property to wp. - Loránd Biró

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.