我有一个列表视图:
<ListView Name="SelectedFeeds">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}"
BasedOn="{StaticResource {x:Type ListViewItem}}">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
</Trigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Name="panel">
<TextBlock x:Name="Title" FontSize="24"
Text="{Binding Title, IsAsync=True}" TextWrapping="Wrap" />
<Label x:Name="PubDate" FontSize="10"
Content="{Binding Path=PubDate, IsAsync=True}" />
<TextBlock my:HtmlParser.HTMLText=
"{Binding Path=Description, IsAsync=True}"
TextWrapping="Wrap"
Width="{Binding ElementName=panel,
Path=ActualWidth}" Height="0" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
DataTemplate 中有一个高度较大的 TextBlock。
At start I'm setting height of this textblock to "0" and when ListViewItem is selected, I need to set that height to "Auto".
这可能可以通过触发器来完成,但我无法弄清楚。