Đối với "mục tổng thể lấp đầy toàn bộ chiều rộng phân bổ cho các ListBox" bạn cần có một phong cách như thế này:
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
và tùy chọn vô hiệu hóa cuộn ngang cho ListBox:
<ListBox ScrollViewer.HorizontalScrollBarVisibility="Disabled" .. >
đối với bảng điều khiển gốc của DataTemplate, bạn có thể sử dụng dockpanel:
<DockPanel>
<SomeControlLeft DockPanel.Dock="Left" Margin="0 0 5 0" />
<SomeControlRight DockPanel.Dock="Right" Margin="5 0 0 0" />
<SomeControlFill />
</DockPanel>
hoặc một mạng lưới:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<SomeControlLeft Grid.Column="0" />
<SomeControlRight Grid.Column="4" />
<SomeControlFill Grid.Column="2" />
</Grid>
Bạn có thể sử dụng một bảng hoặc lưới thành phần cho rằng, thiết lập một hoặc cả hai cột để tự động -kích thước. –