我有ListBox和动态DataTempletes项。 当TextBlock文本换行时,ListBox大小正在添加并且当展开时大小不会更改为旧值且保持不变。 我不明白是什么问题。 TextBlock大小已更改但未更改ListBox。
<ListBox x:Name="ctrlFavOdds"
Grid.Row="2"
ItemsSource="{Binding 'FavStakesList'}"
ItemContainerStyle="{StaticResource alternatingStyle}"
AlternationCount="2"
FontWeight="Bold"
HorizontalContentAlignment="Stretch"
IsHitTestVisible="False"
VerticalAlignment="Top"
VirtualizingStackPanel.IsVirtualizing="True"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0"
Margin="2,0,5,0"
Source="{Binding 'MakeExpressBetImage', Converter={StaticResource 'imageconverter'}}"/>
<TextBlock Grid.Column="1"
TextWrapping="Wrap"
FontSize="12"
Text="{Binding Stake}"
VerticalAlignment="Center"
HorizontalAlignment="Left"/>
<TextBlock Grid.Column="2"
TextWrapping="Wrap"
Margin="5,0,0,0"
Text="{Binding StakeFactor}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="14"/>
<Image Grid.Column="3"
Margin="5,0,2,0"
Source="{Binding 'UpDounImage', Converter={StaticResource imageconverter}}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
当TextBlock文本换行时,当解包时,ListBox大小正在添加并且大小会发生变化,并且不会返回旧值并保持未更改