netniv wrote:
I tried option 1 - removed static from FactorSet; then created a datacontext that pointed to mainwindow as such:
I hate to keep asking for help when I need to just read a book on XAML (I am reading a book on C# 5.0 and the .NET 4.5 framework, but I haven't gotten to any XAML yet), so thanks for your patience!
Actually, I just realised why you are getting this error. The reason is because you are attempting to bind statically to the Application.Current which will be App.xaml/.cs not MainWindow.xaml/cs.Thanks again! I think I'm getting there, but still having trouble. Looks like I have a lot to learn about XAML.
You have a choice between
- Change the static binding to be for your MainWindow. The simpliest way to do that would be to remove the static of the readonly auto property and then simply using a {Binding FactorSet} after setting the datacontext to the mainwindow. If you are using a different datacontext as the default context, you will have to then use ElementName and reference the window by name.
- Reference Application.Current.MainWindow assuming that your MainWindow is the first and main window of the application.
I tried option 1 - removed static from FactorSet; then created a datacontext that pointed to mainwindow as such:
<Window.DataContext>
<local:MainWindow />
</Window.DataContext>
I was then able to actually use the GUI to create the data binding by clicking on DataGridCollectionViewSource, going to the property window, then clicking on the box next to source and clicking "Create Data Binding". Data context was selected and in the path window on the right, I scrolled down and found FactorSet and clicked OK. That resulted in the following:<xcdg:DataGridCollectionViewSource x:Key="key_factors" Source="{Binding FactorSet, Mode=OneWay}" />
Wit this, there were no more complaints of not being able to resolve names, but still no dice on displaying any data. On loading, there's nothing in the panel. I hate to keep asking for help when I need to just read a book on XAML (I am reading a book on C# 5.0 and the .NET 4.5 framework, but I haven't gotten to any XAML yet), so thanks for your patience!