0
當我的應用程序啓動我得到從下拉框第一次發射空,但是當我改變它,我得到推出正確的結果組合框的值空
public partial class MainScreen : Page
{
SQLReader sql;
public MainScreen()
{
InitializeComponent();
sql = new SQLReader();
List<string> st = sql.getQuery("SELECT Name FROM Positions");
PrCombo.ItemsSource = st;
PrCombo.SelectedIndex = 0;
}
private void PrCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
string st = PrCombo.Text; //is null when the app starts
}
}
'string st = PrCombo.Text; //在應用程序啓動時爲空值 - 當然,它在'SelectionChanged'事件中。解釋你的最終目標是什麼? – DGibbs
要閱讀PrCombo(combobox)數據 – Dim
http://msdn.microsoft.com/en-us/library/system.windows.controls.selectionchangedeventargs%28v=vs.110%29.aspx – stijn