0
我正在使用c#編寫silverlight。我必須在滾動條中顯示組合項目。如何將scroollbar添加到c中的組合框項目中#
我試圖做到這一點:
TextBlock txtblkName = generateTextBlock();
ComboBox cb = new ComboBox();
ScrollViewer scrollViewer = new ScrollViewer();
cb.Width = 45;
cb.Height = 20;
foreach (String item in param.Component.Attributes.Items)
cb.ItemsSource = param.Component.Attributes.Items;
scrollViewer.Content = cb;
scrollViewer.HorizontalAlignment = HorizontalAlignment.Center;
scrollViewer.VerticalAlignment = VerticalAlignment.Center;
scrollViewer.ScrollToVerticalOffset(3);
cb.SelectionChanged += (o, e) =>
{
txtblkName.Text = cb.SelectedValue.ToString() + " " + param.Unit;
};
cb.SelectedIndex = param.Component.Attributes.Selected != -1 ? param.Component.Attributes.Selected : 0;
Grid.SetColumn(scrollViewer, 1);
childGrid.Children.Add(scrollViewer);
其在組合框中導致滾動。像這樣的:不
通過滾動條顯示它的項目。 有人可以幫我創建滾動條只顯示不是所有組合框上顯示的項目?
Yaah它的工作。非常感謝Sajeentharan – Sss
你似乎silverlight專家。請問我是否可以解決這個問題? http://stackoverflow.com/questions/24062877/how-to-get-the-scrollviewer-to-scroll-after-statically-set-index-containing-list/24063044?noredirect=1#comment37106250_24063044它仍然沒有回答正確; – Sss
@ user234839 ok會檢查並更新,btw我不是專家 – Sajeetharan