WPF:Cell具有ScrollBar时的ListView.SelectedItem

时间:2017-10-02 22:38:05

标签: c# wpf xaml listview mvvm

我在WPF中遇到了问题。 因此,双击适用于简单的单元格。但是,我使用ScrollBar的列没有反应。如何处理这些细胞?

这是我的代码:

<ListView>
    <GridView>
        <GridViewColumn Header="ColumnWithScroll" IsStretch="True">
            <GridViewColumn.CellTemplate>
                <DataTemplate DataType="SimpleItems">
                    <ScrollViewer HorizontalScrollBarVisibility="Disabled"
                                  VerticalScrollBarVisibility="Auto"                                                
                                  Name="Scroller" MaxHeight="200">
                        <TextBlock Text="{Binding TextBind}">
                        </TextBlock>
                    </ScrollViewer>
                </DataTemplate>
            </GridViewColumn.CellTemplate>
        </GridViewColumn>
        <GridViewColumn Header="Header" Width="150">
            <GridViewColumn.CellTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Smth}" 
                               TextWrapping="WrapWithOverflow"/>
                </DataTemplate>
            </GridViewColumn.CellTemplate>
        </GridViewColumn>
        </GridView.Columns>
    </GridView>
    <ListView.InputBindings>
        <MouseBinding Gesture="LeftDoubleClick" Command="{Binding SomeCommand}"/>
    </ListView.InputBindings>
</ListView>  

1 个答案:

答案 0 :(得分:0)

解决方案: 只需设置属性Focucable =&#34; False&#34; ScrollViewer