我需要爲在後面的代碼中創建的ComboBox設計ComboBoxItem風格。這裏是我到目前爲止的代碼如何將控件作爲參數傳遞給委託
ComboBox cbo1 = new ComboBox();
cbo1.IsTextSearchEnabled = true;
cbo1.IsEditable = true;
grid1.Children.Add(cbo1);
cbo1.Dispatcher.BeginInvoke(new StyleComboBoxItemDelegate(ref StyleComboBoxItem(cbo1), System.Windows.Threading.DispatcherPriority.Background);
public delegate void StyleComboBoxItemDelegate(ComboBox cbo_tostyle);
public void StyleComboBoxItem(ComboBox cbo_tostyle)
{
//code to style the comboboxitem;
}
我收到以下錯誤
1. A ref or out argument must be an assignable variable
2. Method name expected
請有人可以幫我指點,什麼我做錯了嗎?
非常感謝
超酷:),非常感謝。 –