开发者

Partial-filling of a rectangle on Silverlight

开发者 https://www.devze.com 2023-03-16 23:44 出处:网络
I am new in Silverlight. I need to fill a rectangle partially with a SolidColorBrush (like a Bar, I need the border). 开发者_如何学CWith GradientBrush, the change of color is not sharp.

I am new in Silverlight. I need to fill a rectangle partially with a SolidColorBrush (like a Bar, I need the border). 开发者_如何学CWith GradientBrush, the change of color is not sharp.

I can add two rectangles for this, but there has to be a better way.

Any suggestion would be appreciated.

I am using Silverlight 4.0.

Thanks for reading.

-Rakib


What about using gradient brush with gradient stops very close to each other, something like this:

<LinearGradientBrush x:Key="_backgroundBrush" StartPoint="0.5,0" EndPoint="0.5,1">
        <GradientStop Color="Yellow" Offset="0" />
        <GradientStop Color="Yellow" Offset="0.65" />
        <GradientStop Color="Blue" Offset="0.66" />
        <GradientStop Color="Blue" Offset="1" />
</LinearGradientBrush>
0

精彩评论

暂无评论...
验证码 换一张
取 消