本文整理汇总了C#中System.Windows.Controls.DataVisualization.Charting.Chart.GetVisualDescendents方法的典型用法代码示例。如果您正苦于以下问题:C# Chart.GetVisualDescendents方法的具体用法?C# Chart.GetVisualDescendents怎么用?C# Chart.GetVisualDescendents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.DataVisualization.Charting.Chart
的用法示例。
在下文中一共展示了Chart.GetVisualDescendents方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLegend
public static Legend GetLegend(Chart chart)
{
return chart.GetVisualDescendents().OfType<Legend>().FirstOrDefault();
}
示例2: PathFillIsNotDefaultBrush
public void PathFillIsNotDefaultBrush()
{
Chart chart = new Chart();
AreaSeries series = (AreaSeries)DefaultControlToTest;
series.IndependentValueBinding = new Binding();
ObservableCollection<int> itemsSource = new ObservableCollection<int> { 1, 2, 3 };
series.ItemsSource = itemsSource;
chart.Series.Add(series);
TestAsync(
chart,
() => Assert.AreEqual(3, ChartTestUtilities.GetDataPointsForSeries(series).Count()),
() =>
{
Path area = chart.GetVisualDescendents().OfType<Path>().FirstOrDefault();
Assert.AreNotEqual(typeof(SolidColorBrush), area.Fill.GetType());
});
}
示例3: SettingLegendItemStyleAfterTitleWorks
public void SettingLegendItemStyleAfterTitleWorks()
{
Chart chart = new Chart();
DataPointSeries series = DefaultDataPointSeriesToTest;
series.IndependentValueBinding = new Binding();
series.ItemsSource = new int[] { 1, 2, 3 };
series.Title = "Title";
chart.Series.Add(series);
TestAsync(
chart,
() =>
{
Style style = new Style(typeof(LegendItem));
style.Setters.Add(new Setter(Control.FontSizeProperty, 50.0));
series.LegendItemStyle = style;
},
() =>
{
foreach (LegendItem item in chart.GetVisualDescendents().OfType<LegendItem>())
{
Assert.AreEqual(50, item.FontSize);
}
});
}