Windows Programming/WPF

Listbox 선택시 Listview의 Scroll이 자동으로 이동되는 문제

PirTaJa 2016. 8. 8. 13:56

XAML 코드

1
2
3
4
5
6
7
<ListView Name="ImageListView" ScrollViewer.CanContentScroll="False">        
        <ListBox.ItemContainerStyle>
            <Style TargetType="ListBoxItem">
                <EventSetter Event="RequestBringIntoView" Handler="ListBoxItemRequestBringIntoView"/>
            </Style>
        </ListBox.ItemContainerStyle>
</ListView>


CS 코드

1
2
3
4
private void ListBoxItemRequestBringIntoView(object sender , RequestBringIntoViewEventArgs e)
{
    e.Handled = true;
}