popUpControl
及listBoxControl
以下NaN
以高度和宽度返回。也是ActualHeight
0.0
为什么?更重要的是,解决方法是什么?
<Popup Name="popUpControl" IsOpen="True" VerticalAlignment="Top" HorizontalAlignment="Left" >
<ListBox Name="listBoxControl" SelectionChanged="_ListBox_SelectionChanged"
Style="{StaticResource ListBoxStyle}" BorderBrush="Transparent"
MaxHeight="300" MaxWidth="350" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<TextBlock Text="{Binding ID}" VerticalAlignment="Center" Margin="2,0,0,0" />
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" Margin="2,0,0,0" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Popup>