xaml代码如下:
<Window xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" x:Class="PopupControl.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Popup Name="TitlePopue" AllowsTransparency="True" IsOpen="True" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden"
>
<dxc:ChartControl Name="chartPie"
AnimationMode="OnLoad"
BorderThickness="0"
EnableAnimation="True"
ToolTipEnabled="True"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Background="{x:Null}">
<!--<dxc:ChartControl.Titles>
<dxc:Title Dock="Top" HorizontalAlignment="Center" FontSize="10">Area of Countries</dxc:Title>
</dxc:ChartControl.Titles>-->
<dxc:SimpleDiagram2D>
<dxc:SimpleDiagram2D.Series>
<dxc:PieSeries2D x:Name="Series" ArgumentScaleType="Qualitative" AnimationAutoStartMode="SetStartState"
HoleRadiusPercent="10"
Rotation="0"
SweepDirection="Clockwise"
>
<dxc:PieSeries2D.PointAnimation>
<dxc:Pie2DFlyInAnimation Duration="0:0:1.5" PointOrder="Random" />
</dxc:PieSeries2D.PointAnimation>
<dxc:PieSeries2D.PointOptions>
<dxc:PointOptions PointView="ArgumentAndValues">
<dxc:PointOptions.ValueNumericOptions>
<dxc:NumericOptions Format="Percent" Precision="0" />
</dxc:PointOptions.ValueNumericOptions>
</dxc:PointOptions>
</dxc:PieSeries2D.PointOptions>
<dxc:PieSeries2D.Label>
<dxc:SeriesLabel Visible="True"
dxc:PieSeries.LabelPosition="Inside"
RenderMode="RectangleConnectedToCenter" />
</dxc:PieSeries2D.Label>
<dxc:PieSeries2D.Points>
<dxc:SeriesPoint Argument="网络攻击" Value="9" />
<dxc:SeriesPoint Argument="病毒感染" Value="9" />
<dxc:SeriesPoint Argument="安全漏洞" Value="17" />
</dxc:PieSeries2D.Points>
</dxc:PieSeries2D>
</dxc:SimpleDiagram2D.Series>
</dxc:SimpleDiagram2D>
</dxc:ChartControl>
</Popup>
</Grid>
</Window>
cs代码:
chartPie.Animate();
报错信息:
“System.NullReferenceException”类型的未经处理的异常在 PresentationFramework.dll 中发生
其他信息: 未将对象引用设置到对象的实例。
Background="{x:Null}" 设为透明试试?
不行的