我试图使用FSharp.Charting
in添加折线图MainWindow
。在 MainViewModel 我有 -
let chart = Chart.Line [ for i in 0 .. 10 -> (i, i * i) ]
let control = new ChartControl(chart)
member self.LineChart = control
在 xaml -
<WindowsFormsHost Child="{Binding LineChart}" />
当我启动应用程序时,我会得到XamlParseException
以下附加信息 -
'Cannot create unknown type '{http://schemas.microsoft.com/winfx/2006/xaml/presentation}WindowsFormsHost'.' Line number '20' and line position '10'.
如何解决问题?
这是@Foggy Finder。我已经删除了几行定义 TextBlock 和 Buttons。
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ViewModels;assembly=AsyncFS"
xmlns:fsxaml="http://github.com/fsprojects/FsXaml"
Title="MVVM and XAML Type provider" Height="200" Width="400">
<Window.DataContext>
<local:MainViewModel/>
</Window.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<WindowsFormsHost Child="{Binding LineChart}" />
</Grid>