WPF Interview Questions for Beginners & Advanced - Part 5

81. What is Property-based Animation in WPF?

WPF introduces a property-based animation techniques to make animations in WPF easy.

It simply modify the value of control property over an interval of time and the target property must be a dependency property.

82. How many types of Animation support by WPF?

There are baiscally three types of Animation classes.

  1. Linear interpolation Animation
  2. Keyframe Animation
  3. Path based Animation

83. What is Linear Interpolation Animation?

This animation technique increment a control property e.g. width or height one by one point between start and finish value and during a fixed time.

<DoubleAnimation Storyboard.TargetName="myButton" Storyboard.TargetProperty="Height" From="160" To="300" Duration="0:0:5" />

84. What is KeyFrame Animation?

This animation technique animate the property value of a control. But Keyframe animation have multiple target values defined by the KeyFrame objects.

	<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0" />
	<LinearDoubleKeyFrame Value="350" KeyTime="0:0:2" />
	<LinearDoubleKeyFrame Value="50" KeyTime="0:0:7" />
	<LinearDoubleKeyFrame Value="200" KeyTime="0:0:8" />                          

85. Can you tell me some KeyFrame animation types?

Yes, There are around 20 KeyFrame animations types. Some of these are:

  • BooleanAnimationUsingKeyFrames
  • ByteAnimationUsingKeyFrames
  • ColorAnimationUsingKeyFrames
  • DecimalAnimationUsingKeyFrames
  • DoubleAnimationUsingKeyFrames
  • PointAnimationUsingKeyFrames
  • ThicknessAnimationUsingKeyFrames

89. What is Path based animation?

This animation technique animate a property value of control correspond with the shape describe by PathGeometry object.

  RepeatBehavior="Forever" >
		Figures="M 10,100 C 35,0 135,0 160,100 180,190 285,200 310,100" 
		PresentationOptions:Freeze="True" />

90. What is the standard frame rate for Animation in WPF?

The standard frame rate is 60 frames per second.

91. Can you tell me some common properties of Animation classes.

  • From: Starting value from which the animation starts
  • To: End value on which the animation ends
  • Duration: Time limit for the animation
  • By: Change the value of From property by adding the By value.
  • FillBehavior: There are two values of this property.



    • HoldEnd: If keep the animated value in the property of control after the animation ends
    • Stop: If revert the animated value and set the original value before the animation to property of control.

92. What is Storyboard?

Storyboard is the container for animations classes. It is used for apply grouping on animations and also used for controling the animation like pause, stop etc.

<Storyboard x:Name="myStoryboard">
		From="160" To="300" Duration="0:0:5" />

93. What is TargetName and TargetProperty of Storyboard?

TargetName is used for setting the target control name and Target Property is used for setting the target property of control.

94. What is EventTrigger?

EventTrigger is used for starting an animation when an event occurred on control.

		<EventTrigger RoutedEvent="Button.Click">
						<DoubleAnimation Storyboard.TargetProperty="Width" To="300" Duration="0:0:3" />

95. How can you control the Storyboard?

There are several classes available in WPF for controlling Storyboard.

  • PauseStoryboard: Stops storyboard animation
  • ResumeStoryboard: Resume storyboard animation
  • StopStoryboard: Stop storyboardanimation
  • SeekStoryboard: Jumps to specific position in storyboard

96. What are Easing functions in WPF?

Easing functions are used for make more natural look for animations.

<Storyboard x:Name="myStoryboard">
	<DoubleAnimation Storyboard.TargetName="btnGrow" Storyboard.TargetProperty ="Width" To="300" Duration="0:0:2">
			<ElasticEase EasingMode="EaseIn" Oscillations="5" />

97. Can you give some examples of Easing functions.

There are multiple easing functions in WPF.

  1. BackEase
  2. ElasticEase
  3. BounceEase
  4. CircleEase
  5. CubicEase

98. What is Easing In and Easing Out?

These are used in Easing functions.

EaseIn means easing function effect is applied to the starting of animation.

EaseOut means easing function effect is applied to the end of animation.

EaseInOut means easing function effect is applied at both starting and end of animation.

99. Can we use Win32 controls in WPF?

Yes, WPF provides two assemblies for working with Win32 controls.

  • System.Windows.Interop
  • System.Windows.Forms.Integration

100. How you can add Window form control in WPF?

You need to use WindowsFormHost object and assign the Windows Form control as its child control.

		<wf:Button x:Name="winFormButton" Text="Hello Windows Forms" Width="150" />

Join our newsletter and get an occasional email with a technology and DotNetPattern.com news update.