Advertisement
Guest User

RangeGraph

a guest
May 29th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.96 KB | None | 0 0
  1. <rb:RateBase x:Class="RateBar.RateGraph"
  2.             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3.             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4.             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5.             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6.             xmlns:rb="clr-namespace:RateBar"
  7.             xmlns:sd="clr-namespace:System.Windows.Data"
  8.             mc:Ignorable="d">
  9.     <RangeBase.Resources>
  10.         <sd:ArithmeticConverter x:Key="progressConverter"/>
  11.         <rb:JScriptConverter x:Key="JScript" TrapExceptions="False"/>
  12.         <ControlTemplate x:Key="rateGraphTemplate" TargetType="{x:Type rb:RateBase}">
  13.             <Canvas HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
  14.                 <rb:Axis Width="380" Height="88"/>
  15.                 <Rectangle Height="88" Fill="#9690EE90">
  16.                     <Rectangle.Width>
  17.                         <MultiBinding Converter="{StaticResource JScript}" ConverterParameter="values[0]/values[1]*values[2]">
  18.                             <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Value"/>
  19.                             <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Maximum"/>
  20.                             <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Width"/>
  21.                         </MultiBinding>
  22.                     </Rectangle.Width>
  23.                 </Rectangle>
  24.                 <Label Canvas.Left="0" Width="380" HorizontalContentAlignment="Right" Foreground="Black" Content="{Binding Path=Caption, RelativeSource={RelativeSource TemplatedParent}}">
  25.                     <Canvas.Bottom>
  26.                         <MultiBinding Converter="{StaticResource JScript}" ConverterParameter="(values[2]*0.8)/values[1]*values[0]">
  27.                             <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Rate"/>
  28.                             <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="RateMaximum"/>
  29.                             <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Height"/>
  30.                         </MultiBinding>
  31.                     </Canvas.Bottom>
  32.                 </Label>
  33.                 <Line X1="0" X2="380" Stroke="Black">
  34.                     <Canvas.Bottom>
  35.                         <MultiBinding Converter="{StaticResource JScript}" ConverterParameter="(values[2]*0.8)/values[1]*values[0]">
  36.                             <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Rate"/>
  37.                             <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="RateMaximum"/>
  38.                             <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Height"/>
  39.                         </MultiBinding>
  40.                     </Canvas.Bottom>
  41.                 </Line>
  42.             </Canvas>
  43.         </ControlTemplate>
  44.     </RangeBase.Resources>
  45. </rb:RateBase>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement