Tomasz
Tomasz

Reputation: 2061

WPF background colors

I would like to create some colors as my WPF background, but I have 2 issues with that:

  1. When I resize windows, coloring being resized with it. I would like to have it static.
  2. My colors are specific: They are not toned, they should look something like this:

Colors

But the problem is: When I create a gradient in WPF, color changes are kind of blurred.

I have tried to do it that way :

<Window.Background>
    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
        <GradientStop Color="#70116B" Offset="0" />
        <GradientStop Color="#70116B" Offset="0.4" />
        <GradientStop Color="#BBD909" Offset="0.4" />
        <GradientStop Color="#BBD909" Offset="0.5" />
        <GradientStop Color="#0093DD" Offset="0.5" />
        <GradientStop Color="#0093DD" Offset="0.52" />
        <GradientStop Color="White" Offset="0.52" />
        <GradientStop Color="White" Offset="1" />
    </LinearGradientBrush>
</Window.Background>

But like I said: it's not what I want

Upvotes: 0

Views: 2417

Answers (1)

nrudnyk
nrudnyk

Reputation: 944

What you want to achieve isn't a gradient. But i would suggest you to use something like below:

  <Grid>  
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="0.4*"/>
      <ColumnDefinition Width="0.1*"/>
      <ColumnDefinition Width="0.02*"/>
      <ColumnDefinition Width="0.48*"/>
    </Grid.ColumnDefinitions>
    <Grid Grid.Column="0" Background="#70116B"/>
    <Grid Grid.Column="1" Background="#BBD909"/>
    <Grid Grid.Column="2" Background="#0093DD"/>
    <Grid Grid.Column="3" Background="#FFFFFF"/>
  </Grid>

Hope this helps!

Upvotes: 1

Related Questions