ListView WPF中的OxyPlot不显示任何内容

时间:2015-08-03 12:37:31

标签: c# wpf oxyplot

如果我使用:

<oxy:PlotView  MinHeight="260" Height="Auto"   IsRendering="True" FontStyle="Normal" FontFamily="Arial" FontSize="8" Model="{Binding PlotM}">
                        </oxy:PlotView>

正确显示情节。

如果我使用此代码:

<ListView Name="PlotLista"  ItemsSource="{Binding PlotModelList}" >
    <ListView.ItemTemplate>
        <DataTemplate>
           <StackPanel>
              <oxy:PlotView  MinHeight="260" Height="Auto"   IsRendering="True" FontStyle="Normal" FontFamily="Arial" FontSize="8" Model="{Binding}">
              </oxy:PlotView>
            </StackPanel>
         </DataTemplate>
      </ListView.ItemTemplate>
</ListView>

显示bkank元素列表,未显示OxyPlot。 PlotModelList是List<PlotModel>

1 个答案:

答案 0 :(得分:0)

问题是宽度和高度:

     <ListView Name="PlotLista"  ItemsSource="{Binding PlotModelList}" >
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <StackPanel>
                                    <oxy:PlotView  MinHeight="260" Height="Auto" HorizontalContentAlignment="Stretch" MinWidth="700"   IsRendering="True" 
FontStyle="Normal" FontFamily="Arial" FontSize="8" Model="{Binding}">
                                </oxy:PlotView>
                                </StackPanel>
                            </DataTemplate>
                        </ListView.ItemTemplate>