1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using System.Collections.Generic;
6
using System.Collections.ObjectModel;
7
using System.Diagnostics;
9
using System.Windows.Controls;
10
using System.Windows.Documents;
11
using System.Windows.Media;
13
namespace ICSharpCode.Profiler.Controls
15
public class PercentBar : FrameworkElement
17
protected override void OnRender(DrawingContext drawingContext)
19
base.OnRender(drawingContext);
21
if (this.RenderSize.Height > 0 && this.RenderSize.Width > 0) {
22
drawingContext.DrawRectangle(new LinearGradientBrush(Colors.Red, Colors.Orange, 0), new Pen(Brushes.Black, 1), new Rect(new Point(0, 2), new Size(this.RenderSize.Width * this.Value, this.RenderSize.Height - 4)));
26
public static readonly DependencyProperty ValueProperty =
27
DependencyProperty.Register("Value", typeof(double), typeof(PercentBar),
28
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.AffectsMeasure));
33
get { return (double)GetValue(ValueProperty); }
34
set { SetValue(ValueProperty, value); }