templates - Silverlight TemplateBinding to RotateTransform -


I am trying to create the simplest Silverlight templated control, and I think that TemplateBinding is Angle Property RotateTransform's

Here is ControlTemplate from Generic.xaml:

  & amp; the lift; ControlTemplate TargetType = "Local: CtlKnob" & gt; & Lt; Grid X: Name = "Grid" RenderTransformOrigin = "0.5.0.5" & gt; & Lt; Grid.RenderTransform & gt; & Lt; TransformGroup & gt; & Lt; RotateTransform Angle = "{TemplateBinding Angle}" /> & Lt ;! - It does not work - & gt; & Lt ;! - & lt; RotateTransform angle = "70" /> - & gt; & Lt ;! - This works - & gt; & Lt; / TransformGroup & gt; & Lt; /Grid.RenderTransform> & Lt; Ellipse Stroke = "# FFB70404" StrokeTextness = "19" /> & Lt; Alipus stroke = "white" stroke light = "2" height = "16" vertical alignment = "top" horizontal alignment = "center" width = "16" margin = "0,2,0,0" /> & lt; / Grid & gt; & Lt; / ControlTemplate & gt;  

Here C #:

  is using the system. Using System.Windows.Controls; Namespot CTLConnob {Public class CTLConnob: Control {public CTLCob () {this.DefaultStyleKey = typeof (CtlKnob); } Dependent DependencyProperty AngleProperty = DependencyProperty.Register ("angle", typef (double), typef (CTLKN), empty for public static reading; Public Double Angle {Received {Return (Double) GetValue (Angleproperty); } Set {set value (angleproporty, value); Here is an alternative solution:  
   

Code> Public Class TemplatedControl1: Control {Public TemplatedControl1 () {this.DefaultStyleKey = typeof (TemplatedControl1); } Public override zero OnApplyTemplate () {var Transform = this.GetTemplateChild ("Transform1") as RotateTransform; Conversion.angle = this.StartAngle; Base.OnApplyTemplate (); } Start the dependency property for public static readingEngelProperty = Dependency Property. Controls ("startengel", typef (double), typef (temp control 1), empty;); Public Double Startangle {Received {Return (Double) Gate Value (StartjellProperty); } Set {Set Value (StartAngleProperty, value); }}}

and xaml:

  style target type = "local: temp: 1 control" & gt; & Lt; Setter Estates = "Template" & gt; & Lt; Setter.Value & gt; & Lt; ControlTemplate TargetType = "Local: TemplatedControl1" & gt; & Lt; Border background = "{templatebiding background}" borderbrash = "{aligned border brush}" border-bracket = "{splitting bordering borders}" & gt; & Lt; Canvas & gt; & Lt; Polyline Fill = "Black" & gt; & Lt; Polyline.RenderTransform & gt; & Lt; RotateTransform x: name = "transform 1" /> & Lt; /Polyline.RenderTransform> & Lt; / Polyline & gt; & Lt; / Canvas & gt; & Lt; / Border & gt; & Lt; / ControlTemplate & gt; & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; / Style & gt;  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -