SuncoastOwner
SuncoastOwner

Reputation: 263

Opacity Mask Direction Top to Bottom?

I would like to fade the text of a wpf textbox from the top down. not left to right. is there a way to do this in xaml? below is what I have so far

<TextBox x:Name="txtDesc" Text="{x:Static model:CarManager.Desc}" VerticalAlignment="Top" HorizontalAlignment="Left" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto"  Width="466"  FontWeight="Bold" Height="263" Margin="304,195,0,0" BorderBrush="{x:Null}" BorderThickness="0" Background="{x:Null}">
        <TextBox.Foreground>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FF8F8F8F" Offset="0"/>
                <GradientStop Color="White"/>
            </LinearGradientBrush>
        </TextBox.Foreground>
        <TextBox.OpacityMask>
            <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                <GradientStop Offset="0" Color="WhiteSmoke"></GradientStop>
                <GradientStop Offset="1" Color="Transparent"></GradientStop>
            </LinearGradientBrush>
        </TextBox.OpacityMask>
    </TextBox>

this fades the text left to right..I would like to fade it from top down.

Thank You for any help

Upvotes: 0

Views: 550

Answers (1)

Saagar Elias Jacky
Saagar Elias Jacky

Reputation: 2688

Use this

    <TextBox x:Name="txtDesc" Text="{x:Static model:CarManager.Desc}" VerticalAlignment="Top" HorizontalAlignment="Left" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto"  Width="466"  FontWeight="Bold" Height="263" Margin="304,195,0,0" BorderBrush="{x:Null}" BorderThickness="0" Background="{x:Null}">
        <TextBox.Foreground>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FF8F8F8F" Offset="0"/>
                <GradientStop Color="White"/>
            </LinearGradientBrush>
        </TextBox.Foreground>
        <TextBox.OpacityMask>
            <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                <GradientStop Offset="0" Color="WhiteSmoke"></GradientStop>
                <GradientStop Offset="1" Color="Transparent"></GradientStop>
            </LinearGradientBrush>
        </TextBox.OpacityMask>
    </TextBox>

Upvotes: 1

Related Questions