ฉันต้องการให้ ListItems ขยายพื้นหลังสีส้มแบบเต็มความกว้างของกล่องรายการ
ขณะนี้พวกเขามีความกว้างเท่ากับ FirstName + LastName
ฉันได้ตั้งค่าทุกองค์ประกอบที่สามารถทำได้: HorizontalAlignment = "Stretch"
ฉันต้องการพื้นหลังของ ListboxItems เพื่อขยายเมื่อผู้ใช้ยืดกล่องรายการออกดังนั้นฉันไม่ต้องการใส่ค่าสัมบูรณ์
ฉันต้องทำอย่างไรเพื่อให้สีพื้นหลังของ ListBoxItems เติมความกว้างของกล่องรายการ
<Window x:Class="TestListBoxSelectedItemStyle.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:TestListBoxSelectedItemStyle"
    Title="Window1" Height="300" Width="300">
    <Window.Resources>
        <local:CustomerViewModel x:Key="TheDataProvider"/>
        <DataTemplate x:Key="CustomerItemTemplate">
            <Border CornerRadius="5" Background="Orange" HorizontalAlignment="Stretch" Padding="5" Margin="3">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" Width="Auto">
                    <TextBlock HorizontalAlignment="Stretch">
                    <TextBlock.Text>
                        <MultiBinding StringFormat="{}{0} {1}">
                            <Binding Path="FirstName"/>
                            <Binding Path="LastName"/>
                        </MultiBinding>
                    </TextBlock.Text>
                    </TextBlock>
                </StackPanel>
            </Border>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <ListBox ItemsSource="{Binding Path=GetAllCustomers, Source={StaticResource TheDataProvider}}"
                 ItemTemplate="{StaticResource CustomerItemTemplate}"/>
    </Grid>
</Window>