Bind current listbox selection to string property in parent window [modified]
-
Hello, I have a window with a listbox bound to a User table in a DataSet, which displays the userid column: .... I managed to bind the current selection to a DataRowView property in the window: public DataRowView CurrentUser { set { System.Diagnostics.Trace.WriteLine(value); } } However, I'd like to bind to a string property: public string CurrentUser { set; private get; } ...so that I can read the currently selected userid easily via getCurrentUser(). Is that feasible ? Thanks, J-L -- Modified Thursday, March 31, 2011 11:16 AM
-
Hello, I have a window with a listbox bound to a User table in a DataSet, which displays the userid column: .... I managed to bind the current selection to a DataRowView property in the window: public DataRowView CurrentUser { set { System.Diagnostics.Trace.WriteLine(value); } } However, I'd like to bind to a string property: public string CurrentUser { set; private get; } ...so that I can read the currently selected userid easily via getCurrentUser(). Is that feasible ? Thanks, J-L -- Modified Thursday, March 31, 2011 11:16 AM
Is CurrentUser as row? If so then simply get the column value from the datarow. You may need another property or you may be able to bind to required columns value.
Never underestimate the power of human stupidity RAH