0
好吧,我有辦法做到這一點如何綁定集合到一個網格WPF
,但我做的方式在C#像這樣
public partial class PlotTest
{
public PlotTest(double x, double y)
{
InitializeComponent();
PlotControl.Margin = new Thickness(x, y, 0, 0);
}
public void setPlot(List<double> tempSol)
{
double step = (tempSol.Max() - tempSol.Min())/10;
for (int ctr = 0; ctr < 10; ctr++)
{
TextBlock rect = (TextBlock)PlotValue.Children[ctr];
rect.Text = (ctr == 0) ? tempSol.Max().ToString("F") :
(ctr == 9) ? tempSol.Min().ToString("F") :
(tempSol.Max() - ctr * step).ToString("F");
rect.TextAlignment = TextAlignment.Right;
rect.FontSize = 10;
}
}
}
}
,因爲我用C#做到這一點,我正在使用wpf我想找到一種方法將其綁定到一個collectionm,正是這一個
private List<double> tempsol = new List<double> {3.21, -5.41, -15.81, -21.69, -21.70, -12.60, -6.41, -0.06, 5.42, 13.32, 14.12, 7.55};
但是si nce我是新來的wpf,xaml我真的不確定如何做到這一點,我找不到任何直接適用於我的問題的解決方案我可以使用一些幫助謝謝。