我有以下代码:
g++ -o "Project Thoth" main.cpp $(pkg-config --cflags --libs gtk+-3.0 gmodule-2.0 )
Window2.xaml.cs
public class MainViewModel : ObservableObject
{
public MainViewModel()
{
this.sampleName = new string[10];
}
private string[] sampleName;
private string _sampleCount;
public Data obj2 = new Data();
public string this[int pos]
{
get
{
return sampleName[pos];
}
set
{
sampleName[pos] = value;
Console.WriteLine(value);
}
}
public string sampleCount
{
get
{
return _sampleCount;
}
set
{
if (value != _sampleCount)
{
_sampleCount = value;
OnPropertyChanged("sampleCount");
Console.WriteLine("Test");
Console.WriteLine(value);
obj2.sampleCount = value;
SaveFile.saveFileMain(obj2);
}
}
}
}
}
我想知道如何设置sampleName数组的绑定路径,以及是否可以实现OnPropertyChanged方法。 P.S点击按钮触发绑定代码。