I am stuck in the strange situation with WPF Combo-box, Scrolling by Mouse wheel is perfectly working, But when clicked on mouse down arrow of Scrollbar, Items hide, Same happens when trying to drag the scroll bar.
I am using below XAML code
<ComboBox Name="cmbPageNumber" >
<ComboBox.ItemContainerStyle>
<Style TargetType="ComboBoxItem">
<EventSetter Event="PreviewMouseDown" Handler="item_PreviewMouseDown"/>
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox>
void item_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
ComboBoxItem cmbitem = sender as ComboBoxItem;
cmbitem.IsSelected = true;
string value = cmbitem.Content.ToString();
OVTreeItem item = CurrentTreeItemForPaging;
if (item != null && item.PageCounts >= Convert.ToInt32(value))
item.GotoPage = Convert.ToInt32(value);
PagingInfo(item);
EnableDisablePagingButtons();
this.cmbPageNumber.IsDropDownOpen = false;
e.Handled = true;
}
To populate combobox, I am using below code
for (int i = 1; i <= item.PageCounts; i++)
{
cmbPageNumber.Items.Add(i);
}
The interesting thing, When I do right click on combo-box and reopen again, then mouse click and scroll by drag working.
Please help me.