私は最近、CodePlex のモダン UI (メトロ) チャートを発見しました。これは本当に優れているようで、まさにこのプロジェクトを完了するために探していたものです。
https://modernuicharts.codeplex.com/documentation
ただし、私は C# を書いていないので、このような状況ではオンライン コンバーターに依存しています。オンライン コンバーターは通常非常に効果的ですが、このコードを機能させることができないようです。必要な修正の方向性を教えてくれる人はいますか? どうもありがとう!
C# コード:
namespace TestApplication
{
// bind this view model to your page or window (DataContext)
public class TestPageViewModel
{
public ObservableCollection<TestClass> Errors { get; private set; }
public TestPageViewModel()
{
Errors = new ObservableCollection<TestClass>();
Errors.Add(new TestClass() { Category = "Globalization", Number = 75 });
Errors.Add(new TestClass() { Category = "Features", Number = 2 });
Errors.Add(new TestClass() { Category = "ContentTypes", Number = 12 });
Errors.Add(new TestClass() { Category = "Correctness", Number = 83});
Errors.Add(new TestClass() { Category = "Best Practices", Number = 29 });
}
private object selectedItem = null;
public object SelectedItem
{
get
{
return selectedItem;
}
set
{
// selected item has changed
selectedItem = value;
}
}
}
// class which represent a data point in the chart
public class TestClass
{
public string Category { get; set; }
public int Number { get; set; }
}
}
VB.NET 翻訳:
Public Class TestPageViewModel
Public Property Errors() As ObservableCollection(Of TestClass)
Get
Return m_Errors
End Get
Private Set
m_Errors = Value
End Set
End Property
Private m_Errors As ObservableCollection(Of TestClass)
Public Sub New()
Errors = New ObservableCollection(Of TestClass)()
Errors.Add(New TestClass() With { _
Key .Category = "Globalization", _
Key .Number = 75 _
})
Errors.Add(New TestClass() With { _
Key .Category = "Features", _
Key .Number = 2 _
})
Errors.Add(New TestClass() With { _
Key .Category = "ContentTypes", _
Key .Number = 12 _
})
Errors.Add(New TestClass() With { _
Key .Category = "Correctness", _
Key .Number = 83 _
})
Errors.Add(New TestClass() With { _
Key .Category = "Best Practices", _
Key .Number = 29 _
})
End Sub
Private m_selectedItem As Object = Nothing
Public Property SelectedItem() As Object
Get
Return m_selectedItem
End Get
Set
' selected item has changed
m_selectedItem = value
End Set
End Property
End Class
エラー:
Error 2 Name of field or property being initialized in an object initializer must start with '.'. C:\Users\Major\documents\visual studio 2013\Projects\WpfApplication3\WpfApplication3\pModernChart.xaml.vb 17 4 WpfApplication3
Warning 1 'Public Sub New()' in designer-generated type 'WpfApplication3.pModernChart' should call InitializeComponent method. C:\Users\Major\documents\visual studio 2013\Projects\WpfApplication3\WpfApplication3\pModernChart.xaml.vb 14 16 WpfApplication3
Error 1 Type 'ObservableCollection' is not defined. C:\Users\Major\documents\visual studio 2013\Projects\WpfApplication3\WpfApplication3\pModernChart.xaml.vb 2 33 WpfApplication3