How to remove 1px in ItemsPanel on ListBox WPF

43 Views Asked by At

i can not found margin 1px in ListBox items panel.

my xaml code.

<ListBox>
    <ListBox.Resource>
        <Style TargetType="ListBoxItem">
            <Setter Property="Padding" Value="0"/>
            <Setter Property="Margin" Value="0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListBoxItem">
                        <Border Padding="{TemplateBinding Padding}"
                                Margin="{TemplateBinding Margin}"
                                Background="{TemplateBinding Background">
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style TargetType="ListBox">
            <Setter Property="BorderBrush" Value="Black"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="Background" Value="Blue"/>
            <Setter Property="ItemsPanel">
                <Setter.Value>
                   <ItemsPanelTemplate>
                       <UniformGrid Columns="2" Background="Red" Margin="0"/>
                   </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </ListBox.Resource>
</ListBox>

and result image. enter image description here

i want to remove blue background!! please help me!!

0

There are 0 best solutions below