Greg Sansom
Greg Sansom

Reputation: 20840

Separator in ItemsControl renders in different shades for each item

I have an ItemsControl presenting TextBlocks, with a Separator at the bottom of each item.

My problem is that each Separator is rendered in a slightly different shade of gray - it looks really dodgy:

enter image description here

Here is my XAML:

<ItemsControl ItemsSource="{Binding Path=Items}">
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel></StackPanel>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <StackPanel>
                <TextBlock Text="{Binding}" ></TextBlock>
                <Separator></Separator>
            </StackPanel>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

I have also tried using a thin border instead of the Separator, with the same result.

How can I make each line identical?

Upvotes: 1

Views: 1745

Answers (1)

Fredrik Hedblad
Fredrik Hedblad

Reputation: 84657

Try SnapsToDevicePixels="True"

<ItemsControl ItemsSource="{Binding Path=Items}" SnapsToDevicePixels="True">

If this doesn't help you can also try with

Upvotes: 1

Related Questions