本文整理汇总了C#中Windows.UI.Xaml.Controls.Canvas.SetZIndex方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.SetZIndex方法的具体用法?C# Canvas.SetZIndex怎么用?C# Canvas.SetZIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.Controls.Canvas
的用法示例。
在下文中一共展示了Canvas.SetZIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AngularGauge
/// <summary>
/// Initializes a new instance of the <see cref="AngularGauge"/> class.
/// </summary>
public AngularGauge()
{
Canvas = new Canvas();
Content = Canvas;
StickRotateTransform = new RotateTransform {Angle = 180};
Stick = new Path
{
Data = GeometryHelper.Parse("m0,90 a5,5 0 0 0 20,0 l-8,-88 a2,2 0 0 0 -4 0 z"),
Fill = new SolidColorBrush(Colors.CornflowerBlue),
Stretch = Stretch.Fill,
RenderTransformOrigin = new Point(0.5, 0.9),
RenderTransform = StickRotateTransform
};
Canvas.Children.Add(Stick);
Canvas.SetZIndex(Stick, 1);
Canvas.SetBinding(WidthProperty,
new Binding { Path = new PropertyPath("ActualWidth"), Source = this });
Canvas.SetBinding(HeightProperty,
new Binding { Path = new PropertyPath("ActualHeight"), Source = this });
this.SetIfNotSet(SectionsProperty, new List<AngularSection>());
Stick.SetBinding(Shape.FillProperty,
new Binding {Path = new PropertyPath("NeedleFill"), Source = this});
Func<double, string> defaultFormatter = x => x.ToString(CultureInfo.InvariantCulture);
this.SetIfNotSet(LabelFormatterProperty, defaultFormatter);
// this.SetIfNotSet(LabelsEffectProperty, new DropShadowEffect {ShadowDepth = 2, RenderingBias = RenderingBias.Performance});
SizeChanged += (sender, args) =>
{
IsControlLaoded = true;
Draw();
};
Slices = new Dictionary<AngularSection, PieSlice>();
}
示例2: Gauge
/// <summary>
/// Initializes a new instance of the <see cref="Gauge"/> class.
/// </summary>
public Gauge()
{
Canvas = new Canvas();
Content = Canvas;
PieBack = new PieSlice();
Pie = new PieSlice();
MeasureTextBlock = new TextBlock();
LeftLabel = new TextBlock();
RightLabel = new TextBlock();
Canvas.Children.Add(PieBack);
Canvas.Children.Add(Pie);
Canvas.Children.Add(MeasureTextBlock);
Canvas.Children.Add(RightLabel);
Canvas.Children.Add(LeftLabel);
Canvas.SetZIndex(PieBack, 0);
Canvas.SetZIndex(Pie, 1);
PieBack.SetBinding(Shape.FillProperty,
new Binding {Path = new PropertyPath("GaugeBackground"), Source = this});
PieBack.SetBinding(Shape.StrokeThicknessProperty,
new Binding {Path = new PropertyPath("StrokeThickness"), Source = this});
PieBack.SetBinding(Shape.StrokeProperty,
new Binding {Path = new PropertyPath("Stroke"), Source = this});
Pie.SetBinding(Shape.StrokeThicknessProperty,
new Binding { Path = new PropertyPath("StrokeThickness"), Source = this });
Pie.Stroke = new SolidColorBrush(Colors.Transparent);
this.SetIfNotSet(MinHeightProperty, 50d);
this.SetIfNotSet(MinWidthProperty, 80d);
MeasureTextBlock.FontWeight = FontWeights.Bold;
IsNew = true;
SizeChanged += (sender, args) =>
{
IsChartInitialized = true;
Update();
};
}