UIElement.RenderTransformOrigin UIElement.RenderTransformOrigin UIElement.RenderTransformOrigin UIElement.RenderTransformOrigin Property

定義

RenderTransform によって宣言されるすべての使用可能な表示変換の中心点を、要素の境界からの相対位置で取得または設定します。Gets or sets the center point of any possible render transform declared by RenderTransform, relative to the bounds of the element. これは依存関係プロパティです。This is a dependency property.

public:
 property System::Windows::Point RenderTransformOrigin { System::Windows::Point get(); void set(System::Windows::Point value); };
public System.Windows.Point RenderTransformOrigin { get; set; }
member this.RenderTransformOrigin : System.Windows.Point with get, set
Public Property RenderTransformOrigin As Point

プロパティ値

描画変換を宣言する値。The value that declares the render transform. 既定値は座標が (0, 0) の Point です。The default value is a Point with coordinates (0,0).

次の例では、コード内の要素を作成して、適用、 RenderTransformOrigin、し、適用、RenderTransformします。The following example builds up elements in code, applies a RenderTransformOrigin, and then applies a RenderTransform.

public RotateAboutCenterExample()
{
    this.WindowTitle = "Rotate About Center Example";
    NameScope.SetNameScope(this, new NameScope());
    StackPanel myStackPanel = new StackPanel();
    myStackPanel.Margin = new Thickness(50);

    Button myButton = new Button();
    myButton.Name = "myRenderTransformButton";
    this.RegisterName(myButton.Name,myButton);
    myButton.RenderTransformOrigin = new Point(0.5,0.5);
    myButton.HorizontalAlignment = HorizontalAlignment.Left;
    myButton.Content = "Hello World";


    RotateTransform myRotateTransform = new RotateTransform(0);
    myButton.RenderTransform = myRotateTransform;
    this.RegisterName("MyAnimatedTransform",myRotateTransform);

    myStackPanel.Children.Add(myButton);

    //
    // Creates an animation that accelerates through 40% of its duration and
    //      decelerates through the 60% of its duration.
    //
    DoubleAnimation myRotateAboutCenterAnimation = new DoubleAnimation();
    Storyboard.SetTargetName(myRotateAboutCenterAnimation,"MyAnimatedTransform");
    Storyboard.SetTargetProperty(myRotateAboutCenterAnimation,new PropertyPath(RotateTransform.AngleProperty));
    myRotateAboutCenterAnimation.From = 0.0;
    myRotateAboutCenterAnimation.To = 360;
    myRotateAboutCenterAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(1000));

    // Create a Storyboard to contain the animations and
    // add the animations to the Storyboard.
    Storyboard myStoryboard = new Storyboard();
    myStoryboard.Children.Add(myRotateAboutCenterAnimation);

    // Create an EventTrigger and a BeginStoryboard action to
    // start the storyboard.
    EventTrigger myEventTrigger = new EventTrigger();
    myEventTrigger.RoutedEvent = Button.ClickEvent;
    myEventTrigger.SourceName = myButton.Name;
    BeginStoryboard myBeginStoryboard = new BeginStoryboard();
    myBeginStoryboard.Storyboard = myStoryboard;
    myEventTrigger.Actions.Add(myBeginStoryboard);
    myStackPanel.Triggers.Add(myEventTrigger);

    this.Content = myStackPanel;
}
Public Sub New()
	Me.WindowTitle = "Rotate About Center Example"
	NameScope.SetNameScope(Me, New NameScope())
	Dim myStackPanel As New StackPanel()
	myStackPanel.Margin = New Thickness(50)

	Dim myButton As New Button()
	myButton.Name = "myRenderTransformButton"
	Me.RegisterName(myButton.Name,myButton)
	myButton.RenderTransformOrigin = New Point(0.5,0.5)
	myButton.HorizontalAlignment = HorizontalAlignment.Left
	myButton.Content = "Hello World"


	Dim myRotateTransform As New RotateTransform(0)
	myButton.RenderTransform = myRotateTransform
	Me.RegisterName("MyAnimatedTransform",myRotateTransform)

	myStackPanel.Children.Add(myButton)

	'
	' Creates an animation that accelerates through 40% of its duration and
	'      decelerates through the 60% of its duration.
	'
	Dim myRotateAboutCenterAnimation As New DoubleAnimation()
	Storyboard.SetTargetName(myRotateAboutCenterAnimation,"MyAnimatedTransform")
	Storyboard.SetTargetProperty(myRotateAboutCenterAnimation,New PropertyPath(RotateTransform.AngleProperty))
	myRotateAboutCenterAnimation.From = 0.0
	myRotateAboutCenterAnimation.To = 360
	myRotateAboutCenterAnimation.Duration = New Duration(TimeSpan.FromMilliseconds(1000))

	' Create a Storyboard to contain the animations and
	' add the animations to the Storyboard.
	Dim myStoryboard As New Storyboard()
	myStoryboard.Children.Add(myRotateAboutCenterAnimation)

	' Create an EventTrigger and a BeginStoryboard action to
	' start the storyboard.
	Dim myEventTrigger As New EventTrigger()
	myEventTrigger.RoutedEvent = Button.ClickEvent
	myEventTrigger.SourceName = myButton.Name
	Dim myBeginStoryboard As New BeginStoryboard()
	myBeginStoryboard.Storyboard = myStoryboard
	myEventTrigger.Actions.Add(myBeginStoryboard)
	myStackPanel.Triggers.Add(myEventTrigger)

	Me.Content = myStackPanel
End Sub

注釈

RenderTransformOrigin やや非標準の使用、Pointを内の値を構造体、Pointの座標システムで絶対位置を表していません。RenderTransformOrigin has a somewhat nonstandard use of the Point structure value, in that the Point does not represent an absolute location in a coordinate system. 代わりに、0 から 1 までの値は、各 x、y 軸の現在の要素の範囲の要素として解釈されます。Instead, values between 0 and 1 are interpreted as a factor for the range of the current element in each x,y axis. たとえば、(0.5,0.5) が、要素上で中央揃えにする描画変換を (1, 1) または配置描画変換下部にある要素の右下隅。For example, (0.5,0.5) will cause the render transform to be centered on the element, or (1,1) would place the render transform at the bottom right corner of the element. NaN 使用できる値はありません。NaN is not an accepted value.

0 と 1 を超える値も受け入れられ、独創的な変換の効果の詳細になります。Values beyond 0 and 1 are also accepted, and will result in more unconventional transform effects. たとえば、設定した場合RenderTransformOrigin(5,5) を適用し、 RotateTransform、要素自体の境界の外側にも、回転ポイントになります。For instance, if you set RenderTransformOrigin to be (5,5), and then apply a RotateTransform, the rotation point will be well outside the bounds of the element itself. 変換には、右下を超える発信される大きな円の周囲の要素をスピンします。The transform will spin your element around in a big circle that originates beyond bottom right. 原点は、その親要素内で、どこかに可能性があり、フレームまたはビューから可能性がありますする可能性がある可能性があります。The origin might be somewhere inside its parent element and could possibly be possibly out of frame or view. 負の値のポイント値に似ていますが、これらは境界の左上を超えます。Negative point values are similar, these will go beyond the top left bounds.

描画変換がレイアウトには影響しません、および通常はアニメーション化するか、要素に一時的な効果を適用に使用します。Render transforms do not affect layout, and are typically used to animate or apply a temporary effect to an element.

XAML 属性の使用方法XAML Attribute Usage

<object RenderTransformOrigin="xOrigin, yOrigin"/>  

XAML プロパティ要素の使用XAML Property Element Usage

<object>  
  <object.RenderTransformOrigin>  
    <Point X=" xOrigin " Y=" yOrigin "/>  
  </object.RenderTransformOrigin>  
</object>  

XAML 値XAML Values

xOriginxOrigin
左右の余白の係数。The horizontal origin factor. これは通常、0 ~ 1 の値として指定します。This is typically given as a value between 0 and 1. 「解説」を参照してください。See Remarks.

yOriginyOrigin
垂直方向の配信元の係数。The vertical origin factor. これは通常、0 ~ 1 の値として指定します。This is typically given as a value between 0 and 1. 「解説」を参照してください。See Remarks.

依存プロパティ情報Dependency Property Information

識別子フィールドです。Identifier field RenderTransformOriginProperty
メタデータのプロパティを設定するには trueMetadata properties set to true NoneNone

適用対象

こちらもご覧ください