How to add a custom adorner ?

The common way of implementing the rendering of visual element is to override the ‘OnRenderSizeChanged’ method and use one or more ‘DrawingContext’ objects to render the adorner’s visuals as needed. Given below is a simple code snippet for adding rounded corners around the adorned element. [C#] protected override void OnRender(DrawingContext drawingContext) { Rect adornedElementRect = new Rect(this.AdornedElement.DesiredSize); // Some arbitrary drawing implements. SolidColorBrush renderBrush = new SolidColorBrush(Colors.Green); renderBrush.Opacity = 0.2; Pen renderPen = new Pen(new SolidColorBrush(Colors.Navy), 1.5); double renderRadius = 5.0; // Draw a circle at each corner. drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopLeft, renderRadius, renderRadius); drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopRight, renderRadius, renderRadius); drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomLeft, renderRadius, renderRadius); drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomRight, renderRadius, renderRadius); }

When an animation is applied, the property value gets overwritten. How do we prevent the value of property ?

The value of the property on which the animation is applied is overwritten to ’To’ value of the animation because the animation has higher precedence but this can be prevented using the ‘FillBehavior’ property of the animation. By default, FillBehavior has a value ’HoldEnd’ which causes the value of the property to be overwritten to the value when the animation completes. By setting the FillBehavior value to ’Stop’ will prevent overwriting the property value.

How do I apply Transform when an event is occurred ?

This can be done with the following code snippets. [XAML] <StackPanel Name=”SampleStackPanel” MouseEnter=”SampleStackPanel_MouseEnter” MouseLeave=”SampleStackPanel_MouseLeave” > <StackPanel.RenderTransform> <ScaleTransform x:Name=”myScaleTransform” ScaleX=”1″ ScaleY=”1″ /> </StackPanel.RenderTransform> <TextBlock Text=”This is test for render transform”/> </StackPanel> [C#] private void SampleStackPanel_MouseEnter(object sender, MouseEventArgs e) { myScaleTransform.ScaleX = myScaleTransform.ScaleY = 2; } private void SampleStackPanel_MouseLeave(object sender, MouseEventArgs e) { myScaleTransform.ScaleX = myScaleTransform.ScaleY = 1; } Reference link: https://docs.microsoft.com/en-us/dotnet/framework/wpf/graphics-multimedia/how-to-apply-a-transform-to-an-element-when-an-event-occurs

How do I change the location of a model ?

Each model has a particular location in the scene. In order to move the model around the scene, rotate the model or to change it’s size, it is not practical to change the vertices of a model like the 2D objects. Instead 3D models have the ‘Transform’ property with which you can move the models, change their sizes or rotate them.

In what way CombinedGeometry is used ?

CombinedGeometry is used to combine two geometries. By updating the GeometryCombineMode property, along with Union, Intersect, Exclude and Xor options, we can achieve CombinedGeometry. This can be done with the following code snippets. Reference link: https://docs.microsoft.com/en-us/dotnet/framework/wpf/graphics-multimedia/how-to-create-a-combined-geometry