Если вам не нужно поведение выбора списка ListBox
, то использование ItemsControl
обеспечивает правильную компоновку:
<Grid>
<ItemsControl>
<RichTextBox>
<FlowDocument>
<Paragraph >
<Run>this is a test</Run>
</Paragraph>
</FlowDocument>
</RichTextBox>
</ItemsControl>
</Grid>
Но чтобы получить то, о чем вы просили, оберните RichTextBox
в Grid
и затем привяжите к нему ActualWidth
<Grid>
<ListBox HorizontalContentAlignment="Stretch">
<ListBox.Items>
<Grid>
<RichTextBox Width="{Binding Path=ActualWidth, RelativeSource={RelativeSource AncestorType=Grid}}" >
<FlowDocument>
<Paragraph>
<Run>this is a test</Run>
</Paragraph>
</FlowDocument>
</RichTextBox>
</Grid>
</ListBox.Items>
</ListBox>
</Grid>