none
background colors

    Question

  • q1) I have a background color of sky blue but what I want is to have a shade of color  that spans the width of the app for about 100 pixels then another background color. Silverlight seems to allow me to add 1 background color. CAn I add a few colors in different areas on my canvas?

    q2) Can I draw green mountains like this in silverlight?
    http://www.oyunlar1.com/online.php?flash=3301

    Saturday, January 03, 2009 3:44 AM

Answers

  •  

     how do i do the below with code?

     <Grid.Background>
          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
           <GradientStop Color="#FF170EFA"/>
           <GradientStop Color="#FFFFFFFF" Offset="1"/>
           <GradientStop Color="#FF7873FC" Offset="0.41999998688697815"/>
           <GradientStop Color="#FFFCFCFE" Offset="0.52700001001358032"/>
          </LinearGradientBrush>
         </Grid.Background>

    You can try to refer below code:

     LinearGradientBrush line = new LinearGradientBrush();
                line.EndPoint = new Point(0.5, 1);
                line.StartPoint = new Point(0.5,0);

                GradientStop grad1 = new GradientStop();
                grad1.Color = Colors.Red;
                line.GradientStops.Add(grad1);

                GradientStop grad2 = new GradientStop();
                grad2.Color = Colors.Green;
                grad2.Offset = 1;
                line.GradientStops.Add(grad2);

                GradientStop grad3 = new GradientStop();
                grad3.Color = Colors.Blue;
                grad3.Offset = 0.41999998688697815;
                line.GradientStops.Add(grad3);

                GradientStop grad4 = new GradientStop();
                grad4.Color = Colors.Orange;
                grad4.Offset = 0.52700001001358032;
                line.GradientStops.Add(grad4);

    Thursday, January 08, 2009 2:02 AM

All replies

  • should be something like a mountain ( made with belnd 2)

       <Path Margin="72,119.5,104,67.5" Fill="#FF608800" Stretch="Fill" Data="M88,0 L112,39.323662 L136,31.359375 L223.5,111.5 L0.5,111.5 z" StrokeThickness="5" StrokeLineJoin="Bevel" StrokeDashCap="Round" Stroke="#FF95C830"/>
     

    Saturday, January 03, 2009 4:20 AM
  • you can change from property to template sub element like

     <Grid.Background>
          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
           <GradientStop Color="#FF170EFA"/>
           <GradientStop Color="#FFFFFFFF" Offset="1"/>
           <GradientStop Color="#FF7873FC" Offset="0.41999998688697815"/>
           <GradientStop Color="#FFFCFCFE" Offset="0.52700001001358032"/>
          </LinearGradientBrush>
         </Grid.Background>
     

    Saturday, January 03, 2009 4:22 AM
  •  q1)i have a screen 400X400 every 100 pixels in height and 400 length I want a different color so i will have 4 colors here.

    does this do it?

     

    q2)how much memory does drawing take up compared to the same thing on a .png just loaded in?

    Saturday, January 03, 2009 11:32 PM
  • the offset parameter is a kind of percentage so every 100 is 0, 0.25.05.1

    Use expression blend for it

    Sunday, January 04, 2009 5:10 AM
  •  how do i do the below with code?

     <Grid.Background>
          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
           <GradientStop Color="#FF170EFA"/>
           <GradientStop Color="#FFFFFFFF" Offset="1"/>
           <GradientStop Color="#FF7873FC" Offset="0.41999998688697815"/>
           <GradientStop Color="#FFFCFCFE" Offset="0.52700001001358032"/>
          </LinearGradientBrush>
         </Grid.Background>

    Tuesday, January 06, 2009 5:10 PM
  •  

     how do i do the below with code?

     <Grid.Background>
          <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
           <GradientStop Color="#FF170EFA"/>
           <GradientStop Color="#FFFFFFFF" Offset="1"/>
           <GradientStop Color="#FF7873FC" Offset="0.41999998688697815"/>
           <GradientStop Color="#FFFCFCFE" Offset="0.52700001001358032"/>
          </LinearGradientBrush>
         </Grid.Background>

    You can try to refer below code:

     LinearGradientBrush line = new LinearGradientBrush();
                line.EndPoint = new Point(0.5, 1);
                line.StartPoint = new Point(0.5,0);

                GradientStop grad1 = new GradientStop();
                grad1.Color = Colors.Red;
                line.GradientStops.Add(grad1);

                GradientStop grad2 = new GradientStop();
                grad2.Color = Colors.Green;
                grad2.Offset = 1;
                line.GradientStops.Add(grad2);

                GradientStop grad3 = new GradientStop();
                grad3.Color = Colors.Blue;
                grad3.Offset = 0.41999998688697815;
                line.GradientStops.Add(grad3);

                GradientStop grad4 = new GradientStop();
                grad4.Color = Colors.Orange;
                grad4.Offset = 0.52700001001358032;
                line.GradientStops.Add(grad4);

    Thursday, January 08, 2009 2:02 AM