2016-09-23 51 views
0

这里有一些关于这个包的例子。但所有的都在C#中,我似乎无法在VB.NET中重现这些示例。任何人都可以发布一个简单的代码,例如,如何使用LineSeries。如何在UWP VB.NET中实现WinRTXamlToolkit.Controls.DataVisualization.Charting

谢谢!

+0

下面是我使用的转换C#代码的网站:http://converter.telerik.com/ – FloatingKiwi

+0

@FloatingKiwi感谢我的问题提供一个长期的解决方案。非常感激! –

回答

0

但所有都在C#中,我似乎无法在VB.NET中重现这些示例。任何人都可以发布一个简单的代码,例如,如何使用LineSeries

我创建了一个基于这个blog

的XAML代码C#的样品VB.Net样本是一样的C#一个加LineSeries并设置结合IndependentValuePath & DependentValuePath

<Charting:Chart x:Name="LineChart" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="1" Grid.Column="2" Width="400" Height="400"> 
      <Charting:LineSeries Title="Smartphone Companies" IndependentValuePath="Name" DependentValuePath="Amount" IsSelectionEnabled="True"/> 
     </Charting:Chart> 

创建数据表,并分配给LineSeries

Dim rand As New Random() 
     Dim financialStuffList As New List(Of FinancialStuff)() 
     financialStuffList.Add(New FinancialStuff() With { 
           .Name = "MSFT", 
           .Amount = rand.[Next](0, 200) 
           }) 
     financialStuffList.Add(New FinancialStuff() With { 
           .Name = "AAPL", 
           .Amount = rand.[Next](0, 200) 
           }) 
     financialStuffList.Add(New FinancialStuff() With { 
           .Name = "GOOG", 
           .Amount = rand.[Next](0, 200) 
           }) 
     financialStuffList.Add(New FinancialStuff() With { 
           .Name = "BBRY", 
           .Amount = rand.[Next](0, 200) 
           }) 
TryCast(LineChart.Series(0), LineSeries).ItemsSource = financialStuffList 

检查我完成样品here