Architect's Log

I'm a Cloud Architect. I'm highly motivated to reduce toils with driving DevOps.

グラデーションブラシで透明色を使用する

アプリ実行


ソースコード

App.xaml
<Application x:Class="HelloWorld.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
</Application>
MainWindow.xaml
<Window x:Class="HelloWold.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="200" Width="300">
    <UniformGrid>
        <Rectangle Height="150" Width="200">
            <Rectangle.Fill>
                <LinearGradientBrush StartPoint="0, 1" EndPoint="1, 0">
                    <LinearGradientBrush.GradientStops>
                        <GradientStop Offset="0" Color="#FFFF0000" />
                        <GradientStop Offset="0.33" Color="#9900FF00" />
                        <GradientStop Offset="0.66" Color="#FF0000FF" />
                        <GradientStop Offset="0.9" Color="#00FFFFFF" />
                    </LinearGradientBrush.GradientStops>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
    </UniformGrid>
</Window>