0
我使用自定義的行爲滾動列表視圖項到ListView控件的當前可見視圖:應用默認樣式ListViewItem的,而使用自定義的行爲
mvvm how to make a list view auto scroll to a new Item in a list view
<UserControl.Resources>
<Style x:Key="ListBoxItemContainerStyle" TargetType="{x:Type ListBoxItem}"
BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="localBehaviors:ListBoxItemBehavior.IsBroughtIntoViewWhenSelected" Value="true"/>
</Style>
</UserControl.Resources>
<!-- using Caliburn.Micro's conventions to bind ItemsSource -->
<ListView x:Name="Items" ItemContainerStyle="{StaticResource ListBoxItemContainerStyle}"
<ListView.View>
<GridView>
<GridViewColumn Header="Column #1" DisplayMemberBinding="{Binding ValueOfColumnOne}" />
<!-- the rest of columns are defined here using DisplayMemberBinding or GridViewColumn.CellTemplate -->
</GridView
</ListView.View>
</ListView>
的問題是,在描述在SO這個問題,列表視圖項失去其顯示清晰度(模板我猜):
ListView losing GridView display when applying ItemContainerStyle
但是,我不想重新定義ListViewItem的模板;即我想使用WPF提供的默認值。
是的,我最終創建了ListView的行爲,而不是。不過,謝謝你的回答。 – mnn 2013-04-08 16:13:36