CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2012
    Posts
    2

    How to stop mousescroll of combobox from scrolling the page as well at the same time

    I have a WPF form , in that I have a combobox, when I Scroll down the combobox using the Mouse scroll wheel -> it will scroll the page as well as scrolls the combo box. what should I do so that the mouse scroll wheel only scrolls down the combo box and not the whole page.

    Here is how it looks like in xaml:
    <corewpf:RapDataGridFilteredComboBoxColumn MinWidth ="60"
    Header="BU ID"
    HeaderStyle="{StaticResource RequiredColumnStyle}"
    IsReadOnly="True"
    FilterBehaviorType="Contains"
    FilterMemberPath="ShortName"
    FilterSecondaryMemberPath="BusinessUnitID"
    Background="{StaticResource DisabledBackgroundBrush}"
    TextPath="BusinessUnitID"
    CodeMemberPath="BusinessUnitID"
    DescriptionMemberPath="ShortName"
    SelectedValuePath="ID"
    DisplayMemberPath="BusinessUnitID"
    SelectedValueBinding="{Binding Path=BusinessUnitEntityRID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
    ItemsSource="{Binding Path=StaticDataContext.BusinessUnits, Source={StaticResource proxy}}">
    </corewpf:RapDataGridFilteredComboBoxColumn>

    And the code behind for scrollviewer looks like this:
    private void Main_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
    {
    svMain.ScrollToVerticalOffset(svMain.VerticalOffset - e.Delta);
    }

    What should I change/add so that when the combobox is selected the mouse scroll only scrolls the combo box and not both combox and the page.

    Thanks

  2. #2
    Join Date
    Jan 2013
    Posts
    1

    Re: How to stop mousescroll of combobox from scrolling the page as well at the same t

    Try e.Handled=True in the PreviewMouseWheel handler

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured