Microsoft
70-354 · Question #8
On the details page, you render the picture of the computer inside an object of the Rectangle type. You need to implement the ability to rotate the rectangle that contains the picture. How should…
Code Elements: DeltaManipulation ManipulationOrigin OriginalSource RenderTransform Answer Area (Solution): `` void Window_ManipulationDelta(object sender, ManipulationDeltaEventArgs e) { Rectangle rectToMove = e. OriginalSource as Rectangle; Matrix rectsMatrix =…
Manage project site content
Question
On the details page, you render the picture of the computer inside an object of the Rectangle type. You need to implement the ability to rotate the rectangle that contains the picture. How should you complete the code? To answer, drag the appropriate code elements to the correct targets. Each element may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.
Explanation
Code Elements:
- DeltaManipulation
- ManipulationOrigin
- OriginalSource
- RenderTransform
Answer Area (Solution):
void Window_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
{
Rectangle rectToMove = e. OriginalSource as Rectangle;
Matrix rectsMatrix = ((MatrixTransform)rectToMove. RenderTransform ).Matrix;
rectsMatrix.RotateAt(e. DeltaManipulation .Rotation.
e. ManipulationOrigin .X,
e. ManipulationOrigin .Y);
rectToMove.RenderTransform = new MatrixTransform(rectsMatrix);
}
Topics
#UWP#XAML#Rectangle transform#rotation
Community Discussion
No community discussion yet for this question.