This type of fill in rectangle in xaml is it possible?
I don\'t want
Try this:
<Rectangle Width="300" Height="100" Stroke="black" StrokeThickness="3">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0 0" EndPoint="1 0">
<GradientStop Color="red" Offset="0"/>
<GradientStop Color="red" Offset=".33"/>
<GradientStop Color="black" Offset=".33"/>
<GradientStop Color="black" Offset=".34"/>
<GradientStop Color="green" Offset=".34"/>
<GradientStop Color="green" Offset=".66"/>
<GradientStop Color="black" Offset=".66"/>
<GradientStop Color="black" Offset=".67"/>
<GradientStop Color="cyan" Offset=".67"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
Re: your comment -- is the concern simply that it's an N amount of rectangles? If it's not a constraint that it all be one rectangle, you could do something like this:
<ListView ItemsSource="{Binding ColorsTiles}">
<ListView.ItemTemplate>
<DataTemplate>
<ListView ItemsSource="{Binding}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Rectangle Fill="{Binding}" Width="100" Height="100" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
and
ColorsTiles = new ObservableCollection<ObservableCollection<SolidColorBrush>>() {
new ObservableCollection<SolidColorBrush>(){ new SolidColorBrush(Colors.LightGreen), new SolidColorBrush(Colors.LightBlue), new SolidColorBrush(Colors.Blue) },
new ObservableCollection<SolidColorBrush>(){ new SolidColorBrush(Colors.LightSeaGreen), new SolidColorBrush(Colors.Pink), new SolidColorBrush(Colors.Red) } };