Ejemplo n.º 1
0
        // 
        // protected override void OnArrange(Size arrangeSize)
        // Because MediaElement does not have children and it is inexpensive to compute it's alignment/size,
        // it does not need an OnArrange override.  It will simply use its own RenderSize (set when its
        // Arrange is called) in OnRender. 
        //
 
        /// <summary> 
        /// OnRender is called when the Visual is notified that its contents need to be rendered
        /// This lets the MediaElement element know that it needs to render its contents in the given 
        /// DrawingContext
        /// </summary>
        /// <param name="drawingContext">
        /// The DrawingContext to render the video to 
        /// </param>
        protected override void OnRender(DrawingContext drawingContext) 
        { 
            // if nobody set a source on us, then the clock will be null, so we don't render
            // anything 
            if (_helper.Player == null)
            {
                return;
            } 

            drawingContext.DrawVideo(_helper.Player, new Rect(new Point(), RenderSize)); 
 
            return;
        }