WPF Toolkit BusyIndicator with LiveCharts - 指标与图表重叠
WPF Toolkit BusyIndicator with LiveCharts - Indicator is overlapped by the chart
我将 WPF 工具包中的 BusyIndicator 与 LiveCharts 一起使用。不幸的是,该图表与 BusyIndicator 重叠。是否有可能将 BusyIndicator 带到顶层?下面是我的 XAML 代码和一张图片。
<UserControl>
<Grid>
<xctk:BusyIndicator IsBusy="true"/>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<lvc:CartesianChart Grid.Row="0" Series="{Binding SeriesCollection}" Visibility="{Binding IsVisible, Converter={StaticResource BoolToVisibility}}" LegendLocation="Bottom" Margin="15,20,15,0" MinHeight="200" VerticalContentAlignment="Stretch" VerticalAlignment="Stretch" Height="AUTO">
<lvc:CartesianChart.AxisY>
<lvc:Axis Foreground="Black" Title="Temperature">
<lvc:Axis.Separator>
<lvc:Separator Stroke="Transparent" Step="5"/>
</lvc:Axis.Separator>
</lvc:Axis>
<lvc:Axis Foreground="Black" Title="Level" Position="RightTop">
<lvc:Axis.Separator>
<lvc:Separator Stroke="LightGray" Step="10"/>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis Foreground="Black" Labels="{Binding Labels}" LabelsRotation="0">
<lvc:Axis.Separator>
<lvc:Separator Stroke="LightGray" Step="{Binding Seperator.Step}"/>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.ChartLegend>
<lvc:DefaultLegend BulletSize="5" Margin="10" Background="Red"/>
</lvc:CartesianChart.ChartLegend>
</lvc:CartesianChart>
</Grid>
</Grid>
</UserControl>
在底部声明指标,在图表之后,而不是在顶部。将其紧跟在包含图表的嵌套网格之后。这将把它放在图表的 Z 顺序
上方
使用单个 Grid
其中 BusyIndicator
是 最后一个 child:
<UserControl>
<Grid>
<lvc:CartesianChart Grid.Row="0" Series="{Binding SeriesCollection}" Visibility="{Binding IsVisible, Converter={StaticResource BoolToVisibility}}" LegendLocation="Bottom" Margin="15,20,15,0" MinHeight="200" VerticalContentAlignment="Stretch" VerticalAlignment="Stretch" Height="AUTO">
<lvc:CartesianChart.AxisY>
<lvc:Axis Foreground="Black" Title="Temperature">
<lvc:Axis.Separator>
<lvc:Separator Stroke="Transparent" Step="5"/>
</lvc:Axis.Separator>
</lvc:Axis>
<lvc:Axis Foreground="Black" Title="Level" Position="RightTop">
<lvc:Axis.Separator>
<lvc:Separator Stroke="LightGray" Step="10"/>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis Foreground="Black" Labels="{Binding Labels}" LabelsRotation="0">
<lvc:Axis.Separator>
<lvc:Separator Stroke="LightGray" Step="{Binding Seperator.Step}"/>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.ChartLegend>
<lvc:DefaultLegend BulletSize="5" Margin="10" Background="Red"/>
</lvc:CartesianChart.ChartLegend>
</lvc:CartesianChart>
<xctk:BusyIndicator IsBusy="true"/>
</Grid>
</UserControl>
我将 WPF 工具包中的 BusyIndicator 与 LiveCharts 一起使用。不幸的是,该图表与 BusyIndicator 重叠。是否有可能将 BusyIndicator 带到顶层?下面是我的 XAML 代码和一张图片。
<UserControl>
<Grid>
<xctk:BusyIndicator IsBusy="true"/>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<lvc:CartesianChart Grid.Row="0" Series="{Binding SeriesCollection}" Visibility="{Binding IsVisible, Converter={StaticResource BoolToVisibility}}" LegendLocation="Bottom" Margin="15,20,15,0" MinHeight="200" VerticalContentAlignment="Stretch" VerticalAlignment="Stretch" Height="AUTO">
<lvc:CartesianChart.AxisY>
<lvc:Axis Foreground="Black" Title="Temperature">
<lvc:Axis.Separator>
<lvc:Separator Stroke="Transparent" Step="5"/>
</lvc:Axis.Separator>
</lvc:Axis>
<lvc:Axis Foreground="Black" Title="Level" Position="RightTop">
<lvc:Axis.Separator>
<lvc:Separator Stroke="LightGray" Step="10"/>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis Foreground="Black" Labels="{Binding Labels}" LabelsRotation="0">
<lvc:Axis.Separator>
<lvc:Separator Stroke="LightGray" Step="{Binding Seperator.Step}"/>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.ChartLegend>
<lvc:DefaultLegend BulletSize="5" Margin="10" Background="Red"/>
</lvc:CartesianChart.ChartLegend>
</lvc:CartesianChart>
</Grid>
</Grid>
</UserControl>
在底部声明指标,在图表之后,而不是在顶部。将其紧跟在包含图表的嵌套网格之后。这将把它放在图表的 Z 顺序
上方使用单个 Grid
其中 BusyIndicator
是 最后一个 child:
<UserControl>
<Grid>
<lvc:CartesianChart Grid.Row="0" Series="{Binding SeriesCollection}" Visibility="{Binding IsVisible, Converter={StaticResource BoolToVisibility}}" LegendLocation="Bottom" Margin="15,20,15,0" MinHeight="200" VerticalContentAlignment="Stretch" VerticalAlignment="Stretch" Height="AUTO">
<lvc:CartesianChart.AxisY>
<lvc:Axis Foreground="Black" Title="Temperature">
<lvc:Axis.Separator>
<lvc:Separator Stroke="Transparent" Step="5"/>
</lvc:Axis.Separator>
</lvc:Axis>
<lvc:Axis Foreground="Black" Title="Level" Position="RightTop">
<lvc:Axis.Separator>
<lvc:Separator Stroke="LightGray" Step="10"/>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis Foreground="Black" Labels="{Binding Labels}" LabelsRotation="0">
<lvc:Axis.Separator>
<lvc:Separator Stroke="LightGray" Step="{Binding Seperator.Step}"/>
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
<lvc:CartesianChart.ChartLegend>
<lvc:DefaultLegend BulletSize="5" Margin="10" Background="Red"/>
</lvc:CartesianChart.ChartLegend>
</lvc:CartesianChart>
<xctk:BusyIndicator IsBusy="true"/>
</Grid>
</UserControl>