필자는 CodePlex에서 현대 UI (Metro) Charts를 발견했으며,이 프로젝트를 완료하기 위해 찾고있는 것을 정확하게 찾았습니다. 그들은 일반적으로 매우 효과적이지만이 코드가 작동하려면 얻이 수없는 것 - 나는 C 번호를 작성하지 않기 때문에C#에서 VB.NET으로 변환 - 어디에서 잘못 될까요?
https://modernuicharts.codeplex.com/documentation
그러나,이 같은 상황에서 온라인 컨버터에 의존하고 있습니다. 누구든지 필요한 수정안의 방향으로 나를 가리킬 수 있습니까? 많은 감사!
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
적절한 공간이 필요합니다. 그들에 대해서는 당신이 이해하지 못하니? –
내 .. VB에서 C#을 다시 작성하려고합니다. 그래서 나는 VB # ** ** ** C#보다 더 잘 알고 있다고 가정합니다. 그렇다면 ** 컴파일러 ** 오류 메시지를 이해할 때 어떤 문제가 있습니까? 그것들은 100 % 순 VB 및 .Net 문제와 관련이 있습니다. 그들은 명확하고 VB를 안다면 꽤 분명해야합니다. 정확히 당신은 그 (것)들에서 이해하지 못합니까? – quetzalcoatl