0

I am working on a wpf application which uses third party infragistics controls.For dropdows we are using xamcomboeditor. I want to find reference of scroll bar arrow head button in my code behind file. Is that possible?

ashutosh
  • 11
  • 1
  • Usfull link http://www.codeproject.com/Articles/64129/WPF-Custom-ListBox-with-Scrollbar-on-the-Backgroun – Noam M Jun 01 '15 at 11:07

1 Answers1

0

In order to access your element, you can first obtain the relevant ScrollBar from the XamComboEditor ScrollViewer's ControlTemplate and you can find out how to do that from the How to: Find ControlTemplate-Generated Elements page on MSDN. In order to do that though, you will need to know the names of the elements within the default controlTemplate and you can find how to access that in my answer to the How to Extract Default Control Template In Visual Studio? question here on Stack Overflow.

It's difficult to answer without knowing the elements in the default ControlTemplate, but in short, it will be something like this:

ScrollViewer scrollViewer = 
    (ScrollViewer)comboBox.Template.FindName("NameOfScrollViewer", comboBox);
ScrollBar scrollBar = 
    (ScrollBar)scrollViewer.Template.FindName("PART_VerticalScrollBar", scrollViewer);
Community
  • 1
  • 1
Sheridan
  • 68,826
  • 24
  • 143
  • 183
  • how to determine name of scrollbar. – ashutosh Jun 02 '15 at 05:39
  • Actually, the issue is, when we click on the scroll bar arrow head button, it scrolls but the dropdown gets closed as we click. Could you suggest any reason for it. – ashutosh Jun 02 '15 at 05:40
  • Perhaps you should have mentioned the *actual issue* in your question so I could have avoided wasting my time answering a different question? You might be able to fix that using the [`IInputElement.IsKeyboardFocusWithin` Property](https://msdn.microsoft.com/en-us/library/system.windows.iinputelement.iskeyboardfocuswithin(v=vs.110).aspx), but you should probably just contact Infragistics about that issue. – Sheridan Jun 02 '15 at 08:06
  • Sorry for the trouble caused. Its still not working. Could you tell me how to open xamcomboeditor dropdown programatically. – ashutosh Jun 02 '15 at 10:51
  • I don't know anything about the `XamComboEditor`, but if it extends the standard `ComboBox` control, then it should have a [`ComboBox.IsDropDownOpen` Property](https://msdn.microsoft.com/en-us/library/system.windows.controls.combobox.isdropdownopen(v=vs.110).aspx) that you can use to programmatically open the drop down. – Sheridan Jun 02 '15 at 11:20