Binding a WPF ComboBox to a custom list

I have a ComboBox that doesn’t seem to update the SelectedItem/SelectedValue. The ComboBox ItemsSource is bound to a property on a ViewModel class that lists a bunch of RAS phonebook entries as a CollectionView. Then I’ve bound (at separate times) both the SelectedItem or SelectedValue to another property of the ViewModel. I have added a … Read more

WPF and initial focus

It seems that when a WPF application starts, nothing has focus. This is really weird. Every other framework I’ve used does just what you’d expect: puts initial focus on the first control in the tab order. But I’ve confirmed that it’s WPF, not just my app — if I create a new Window, and just … Read more

The calling thread must be STA, because many UI components require this

I am using http://www.codeproject.com/KB/IP/Facebook_API.aspx I am trying to call the XAML which is created using WPF. But it gives me an error: The calling thread must be STA, because many UI components require this. I don’t know what to do. I am trying to do this: FacebookApplication.FacebookFriendsList ffl = new FacebookFriendsList(); But it is giving … Read more

WPF datagrid empty row at bottom

I bind my datagrid using //fill datagrid public DataTable GameData { get { DataSet ds = new DataSet(); FileStream fs = new FileStream(IMDB.WebPage.Class.Config.XMLPath, FileMode.Open, FileAccess.Read); StreamReader reader = new StreamReader(fs, Encoding.Default); ds.ReadXml(reader); fs.Close(); DataTable temp = ds.Tables[0]; return ds.Tables[0]; } } For some reason I get an empty row at the bottom. And sometimes after … Read more