开发者

How to set scrollbar in combobox from Top?

开发者 https://www.devze.com 2023-03-16 08:45 出处:网络
I have combobox in my wpf Application.when i opened it , it i开发者_C百科s opening properly.But the scrollbar in my combobox starting from Bottom with a blank.I want to set the scrollbar from Top with

I have combobox in my wpf Application.when i opened it , it i开发者_C百科s opening properly.But the scrollbar in my combobox starting from Bottom with a blank.I want to set the scrollbar from Top with a blank.Please give me answer...


just set dropdownlist.selectedindex = 0 .


Find The ScrollViewer Control, then use its method to scroll.

such as :

var scrollViewerCombo = this.SubjectSelectComboBox.Template.FindName("PART_ScrollViewer", this.SubjectSelectComboBox) as ScrollViewer;
scrollViewerCombo?.ScrollToTop();

or

var popup = SubjectSelectComboBox.Template.FindName("Popup",SubjectSelectComboBox) as Popup;
var scrollViewer = ((Grid)((Border)popup.Child).Child).Children[0] as ScrollViewer;
scrollViewer.ScrollToTop();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号