Everything compiles, but at run time a blank row is displayed. If I try to edit an entry, it says "No XPath set". What am I doing wrong? I tried a ton of variations, not having the INotifyPropertyChanged interface etc.
The base class is:
public class Variable : INotifyPropertyChanged
{
public string Name;
public string Value;
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
}
The observable collection is:
public class VariableCollection:ObservableCollection<Variable>
{
public VariableCollection()
: base()
{
}
public VariableCollection(List<Variable> list)
: base(list)
{
}
}
The binding is:
public VariablesView(VariableCollection variables)
{
InitializeComponent();
gridContent.ItemsSource = variables;
}
The XAML is:
<DataGrid Name="gridContent" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Name}" Header="Name" />
<DataGridTextColumn Binding="{Binding Value}" Header="Value" />
</DataGrid.Columns>
</DataGrid>