开发者

How to set scrollbar in combobox from Top?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜