简体   繁体   中英

Hatch patterns in XAML silverlight

I want to fill the remaining portion of the texbox with hatch patterns (diagonal line) using XAML for silverlight. I know the Silverlight is out of date and not in support. But i have a code which i need to fix. I am not sure how to implement the hatch patterns without VisualBrush as we do for WPF.

I tried with Linearbrush, but unable to implement it

<LinearGradientBrush x:Key="DiagonalLine" EndPoint="0,0" StartPoint="8,8" 
                     MappingMode="Absolute" SpreadMethod="Repeat">
    <GradientStop Color="Black" Offset="0" />
    <GradientStop Color="Black" Offset="0.1" />
    <GradientStop Color="White" Offset="0.1" />
    <GradientStop Color="White" Offset="1" />
</LinearGradientBrush>

I tried the below code and it works

 <Rectangle Grid.Column="1" Margin="10,0,0,0" Stroke="{Binding Appointment.BorderAppointmentBackground}"
                           StrokeThickness="2">
                    <Rectangle.Fill>
                        <LinearGradientBrush MappingMode="Absolute" SpreadMethod="Repeat"
                                             StartPoint="0,0" EndPoint="5.0, 5.0">
                            <GradientStop Color="{Binding Appointment.BorderAppointmentBackground}"/>
                            <GradientStop Color="{Binding Appointment.BorderAppointmentBackground}" Offset="0.1"/>
                            <GradientStop Color="#FFFFFFFF" Offset="0.3"/>
                            <GradientStop Color="#FFFFFFFF" Offset="0.3"/>
                        </LinearGradientBrush>
                    </Rectangle.Fill>
                </Rectangle>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM