Table of Contents

Class VideoView

Namespace
VisioForge.Core.UI.Uno
Assembly
VisioForge.Core.UI.Uno.dll

A cross-platform video view control for Uno Platform that provides hardware-accelerated video rendering.

public sealed class VideoView : Grid, IAnimationObject, IVisualElement, IVisualElement2, IDependencyObjectStoreProvider, IWeakReferenceProvider, IEnumerable, IDataContextProvider, DependencyObject, ILayoutConstraints, IVideoView, IDisposable, INotifyPropertyChanged

Inheritance

UIElement
FrameworkElement
Panel
Grid

Implements

IAnimationObject
IVisualElement
IVisualElement2
IDependencyObjectStoreProvider
IWeakReferenceProvider
IDataContextProvider
DependencyObject
ILayoutConstraints
IVideoView

Inherited Members

Grid.GetRow(UIElement)
Grid.SetRow(UIElement, int)
Grid.GetColumn(UIElement)
Grid.SetColumn(UIElement, int)
Grid.GetRowSpan(UIElement)
Grid.SetRowSpan(UIElement, int)
Grid.GetColumnSpan(UIElement)
Grid.SetColumnSpan(UIElement, int)
Grid.RowDefinitions
Grid.ColumnDefinitions
Grid.BackgroundSizingProperty
Grid.BackgroundSizing
Grid.BorderBrush
Grid.BorderBrushProperty
Grid.BorderThickness
Grid.BorderThicknessProperty
Grid.Padding
Grid.PaddingProperty
Grid.CornerRadius
Grid.CornerRadiusProperty
Grid.RowProperty
Grid.ColumnProperty
Grid.RowSpanProperty
Grid.ColumnSpanProperty
Grid.RowSpacing
Grid.RowSpacingProperty
Grid.ColumnSpacing
Grid.ColumnSpacingProperty
Panel.Add(UIElement)
Panel.BackgroundTransition
Panel.Children
Panel.ChildrenTransitions
Panel.ChildrenTransitionsProperty
Panel.IsItemsHostProperty
Panel.IsItemsHost
FrameworkElement.DeferTree(DependencyObject)
FrameworkElement.ToString()
FrameworkElement.GetAccessibilityInnerText()
FrameworkElement.GetAutomationPeer()
FrameworkElement.FindFirstParent<T>()
FrameworkElement.FindFirstParent<T>(bool)
FrameworkElement.Dispose()
FrameworkElement.AdjustArrange(Size)
FrameworkElement.FindName(string)
FrameworkElement.ApplyBindingPhase(int)
FrameworkElement.GetEnumerator()
FrameworkElement.Language
FrameworkElement.Triggers
FrameworkElement.ActualHeightProperty
FrameworkElement.ActualThemeProperty
FrameworkElement.ActualWidthProperty
FrameworkElement.LanguageProperty
FrameworkElement.NameProperty
FrameworkElement.ActualWidth
FrameworkElement.ActualHeight
FrameworkElement.HorizontalAlignmentProperty
FrameworkElement.HorizontalAlignment
FrameworkElement.VerticalAlignmentProperty
FrameworkElement.VerticalAlignment
FrameworkElement.WidthProperty
FrameworkElement.Width
FrameworkElement.HeightProperty
FrameworkElement.Height
FrameworkElement.MinWidthProperty
FrameworkElement.MinWidth
FrameworkElement.MinHeightProperty
FrameworkElement.MinHeight
FrameworkElement.MaxWidthProperty
FrameworkElement.MaxWidth
FrameworkElement.MaxHeightProperty
FrameworkElement.MaxHeight
FrameworkElement.MarginProperty
FrameworkElement.Margin
FrameworkElement.IsLoaded
FrameworkElement.UseConstraintOptimizations
FrameworkElement.AreDimensionsConstrained
FrameworkElement.Tag
FrameworkElement.TagProperty
FrameworkElement.FlowDirection
FrameworkElement.FlowDirectionProperty
FrameworkElement.Resources
FrameworkElement.Parent
FrameworkElement.BaseUri
FrameworkElement.Style
FrameworkElement.StyleProperty
FrameworkElement.RequestedTheme
FrameworkElement.RequestedThemeProperty
FrameworkElement.ActualTheme
FrameworkElement.FocusVisualSecondaryThicknessProperty
FrameworkElement.FocusVisualSecondaryThickness
FrameworkElement.FocusVisualSecondaryBrushProperty
FrameworkElement.FocusVisualSecondaryBrush
FrameworkElement.FocusVisualPrimaryThicknessProperty
FrameworkElement.FocusVisualPrimaryThickness
FrameworkElement.FocusVisualPrimaryBrush
FrameworkElement.FocusVisualPrimaryBrushProperty
FrameworkElement.FocusVisualMargin
FrameworkElement.FocusVisualMarginProperty
FrameworkElement.AllowFocusWhenDisabled
FrameworkElement.AllowFocusWhenDisabledProperty
FrameworkElement.AllowFocusOnInteraction
FrameworkElement.AllowFocusOnInteractionProperty
FrameworkElement.TransitionsProperty
FrameworkElement.Transitions
FrameworkElement.Background
FrameworkElement.BackgroundProperty
FrameworkElement.RenderPhase
FrameworkElement.Name
FrameworkElement.SizeChanged
FrameworkElement.ActualThemeChanged
FrameworkElement.LayoutUpdated
FrameworkElement.EffectiveViewportChanged
FrameworkElement.Loading
FrameworkElement.Loaded
FrameworkElement.Unloaded
UIElement.Measure(Size)
UIElement.Arrange(Rect)
UIElement.InvalidateMeasure()
UIElement.InvalidateArrange()
UIElement.StartAnimation(ICompositionAnimationBase)
UIElement.StopAnimation(ICompositionAnimationBase)
UIElement.PopulatePropertyInfo(string, AnimationPropertyInfo)
UIElement.GetVisualInternal()
UIElement.TryStartDirectManipulation(Pointer)
UIElement.StartBringIntoView()
UIElement.StartBringIntoView(BringIntoViewOptions)
UIElement.RegisterAsScrollPort(UIElement)
UIElement.Focus(FocusState)
UIElement.TransformToVisual(UIElement)
UIElement.UpdateLayout()
UIElement.TryInvokeKeyboardAccelerator(ProcessKeyboardAcceleratorEventArgs)
UIElement.CancelDirectManipulations()
UIElement.StartDragAsync(PointerPoint)
UIElement.CapturePointer(Pointer)
UIElement.ReleasePointerCapture(Pointer)
UIElement.ReleasePointerCaptures()
UIElement.AddHandler(RoutedEvent, object, bool)
UIElement.RemoveHandler(RoutedEvent, object)
UIElement.GetValue(DependencyProperty)
UIElement.SetValue(DependencyProperty, object)
UIElement.ClearValue(DependencyProperty)
UIElement.ReadLocalValue(DependencyProperty)
UIElement.GetAnimationBaseValue(DependencyProperty)
UIElement.RegisterPropertyChangedCallback(DependencyProperty, DependencyPropertyChangedCallback)
UIElement.UnregisterPropertyChangedCallback(DependencyProperty, long)
UIElement.ToString()
UIElement.SetBinding(object, string, BindingBase)
UIElement.SetBinding(string, BindingBase)
UIElement.SetBinding(DependencyProperty, BindingBase)
UIElement.SetBindingValue(object, string)
UIElement.GetBindingExpression(DependencyProperty)
UIElement.ResumeBindings()
UIElement.SuspendBindings()
UIElement.RotationTransition
UIElement.KeyTipTarget
UIElement.KeyTipPlacementMode
UIElement.KeyTipHorizontalOffset
UIElement.IsTapEnabled
UIElement.IsRightTapEnabled
UIElement.IsHoldingEnabled
UIElement.IsDoubleTapEnabled
UIElement.AccessKey
UIElement.HighContrastAdjustment
UIElement.ExitDisplayModeOnAccessKeyInvoked
UIElement.OpacityTransition
UIElement.CompositeMode
UIElement.CanBeScrollAnchor
UIElement.CacheMode
UIElement.AccessKeyScopeOwner
UIElement.IsAccessKeyScope
UIElement.KeyTipVerticalOffset
UIElement.CenterPoint
UIElement.UseLayoutRounding
UIElement.TranslationTransition
UIElement.TransformMatrix
UIElement.Rotation
UIElement.RasterizationScale
UIElement.Projection
UIElement.ScaleTransition
UIElement.Scale
UIElement.RotationAxis
UIElement.Transform3D
UIElement.Lights
UIElement.AccessKeyProperty
UIElement.AccessKeyScopeOwnerProperty
UIElement.CacheModeProperty
UIElement.CanBeScrollAnchorProperty
UIElement.CharacterReceivedEvent
UIElement.CompositeModeProperty
UIElement.ContextRequestedEvent
UIElement.ExitDisplayModeOnAccessKeyInvokedProperty
UIElement.HighContrastAdjustmentProperty
UIElement.IsAccessKeyScopeProperty
UIElement.IsDoubleTapEnabledProperty
UIElement.IsHoldingEnabledProperty
UIElement.IsRightTapEnabledProperty
UIElement.IsTapEnabledProperty
UIElement.KeyTipHorizontalOffsetProperty
UIElement.KeyTipPlacementModeProperty
UIElement.KeyTipTargetProperty
UIElement.KeyTipVerticalOffsetProperty
UIElement.LightsProperty
UIElement.PreviewKeyDownEvent
UIElement.PreviewKeyUpEvent
UIElement.ProjectionProperty
UIElement.Transform3DProperty
UIElement.UseLayoutRoundingProperty
UIElement.DesiredSize
UIElement.ActualSize
UIElement.ActualOffset
UIElement.Translation
UIElement.Shadow
UIElement.ShadowProperty
UIElement.Clip
UIElement.ClipProperty
UIElement.RenderTransform
UIElement.RenderTransformProperty
UIElement.RenderTransformOrigin
UIElement.RenderTransformOriginProperty
UIElement.RenderSize
UIElement.XYFocusKeyboardNavigation
UIElement.XYFocusKeyboardNavigationProperty
UIElement.XYFocusDownNavigationStrategy
UIElement.XYFocusDownNavigationStrategyProperty
UIElement.XYFocusLeftNavigationStrategy
UIElement.XYFocusLeftNavigationStrategyProperty
UIElement.XYFocusRightNavigationStrategy
UIElement.XYFocusRightNavigationStrategyProperty
UIElement.XYFocusUpNavigationStrategy
UIElement.XYFocusUpNavigationStrategyProperty
UIElement.TabFocusNavigation
UIElement.TabFocusNavigationProperty
UIElement.FocusState
UIElement.FocusStateProperty
UIElement.IsTabStop
UIElement.IsTabStopProperty
UIElement.TabIndex
UIElement.TabIndexProperty
UIElement.XYFocusUp
UIElement.XYFocusUpProperty
UIElement.XYFocusDown
UIElement.XYFocusDownProperty
UIElement.XYFocusLeft
UIElement.XYFocusLeftProperty
UIElement.XYFocusRight
UIElement.XYFocusRightProperty
UIElement.UseSystemFocusVisuals
UIElement.UseSystemFocusVisualsProperty
UIElement.ManipulationModeProperty
UIElement.ManipulationMode
UIElement.CanDragProperty
UIElement.CanDrag
UIElement.AllowDropProperty
UIElement.AllowDrop
UIElement.PointerCapturesProperty
UIElement.PointerCaptures
UIElement.IsHitTestVisibleProperty
UIElement.IsHitTestVisible
UIElement.OpacityProperty
UIElement.Opacity
UIElement.VisibilityProperty
UIElement.Visibility
UIElement.ContextFlyoutProperty
UIElement.ContextFlyout
UIElement.KeyboardAccelerators
UIElement.KeyboardAcceleratorPlacementMode
UIElement.KeyboardAcceleratorPlacementModeProperty
UIElement.KeyboardAcceleratorPlacementTarget
UIElement.KeyboardAcceleratorPlacementTargetProperty
UIElement.Handle
UIElement.PointerPressedEvent
UIElement.PointerReleasedEvent
UIElement.PointerEnteredEvent
UIElement.PointerExitedEvent
UIElement.PointerMovedEvent
UIElement.PointerCanceledEvent
UIElement.PointerCaptureLostEvent
UIElement.PointerWheelChangedEvent
UIElement.ManipulationStartingEvent
UIElement.ManipulationStartedEvent
UIElement.ManipulationDeltaEvent
UIElement.ManipulationInertiaStartingEvent
UIElement.ManipulationCompletedEvent
UIElement.TappedEvent
UIElement.DoubleTappedEvent
UIElement.RightTappedEvent
UIElement.HoldingEvent
UIElement.DragEnterEvent
UIElement.DragOverEvent
UIElement.DragLeaveEvent
UIElement.DropEvent
UIElement.KeyDownEvent
UIElement.KeyUpEvent
UIElement.GettingFocusEvent
UIElement.LosingFocusEvent
UIElement.NoFocusCandidateFoundEvent
UIElement.BringIntoViewRequestedEvent
UIElement.EventsBubblingInManagedCodeProperty
UIElement.EventsBubblingInManagedCode
UIElement.XamlRoot
UIElement.Dispatcher
UIElement.DispatcherQueue
UIElement.IsStoreInitialized
UIElement.DataContext
UIElement.DataContextProperty
UIElement.AccessKeyDisplayDismissed
UIElement.AccessKeyDisplayRequested
UIElement.CharacterReceived
UIElement.ContextCanceled
UIElement.ContextRequested
UIElement.PreviewKeyDown
UIElement.PreviewKeyUp
UIElement.AccessKeyInvoked
UIElement.ProcessKeyboardAccelerators
UIElement.LostFocus
UIElement.GotFocus
UIElement.LosingFocus
UIElement.GettingFocus
UIElement.NoFocusCandidateFound
UIElement.BringIntoViewRequested
UIElement.PointerCanceled
UIElement.PointerCaptureLost
UIElement.PointerEntered
UIElement.PointerExited
UIElement.PointerMoved
UIElement.PointerPressed
UIElement.PointerReleased
UIElement.PointerWheelChanged
UIElement.ManipulationStarting
UIElement.ManipulationStarted
UIElement.ManipulationDelta
UIElement.ManipulationInertiaStarting
UIElement.ManipulationCompleted
UIElement.Tapped
UIElement.DoubleTapped
UIElement.RightTapped
UIElement.Holding
UIElement.DragStarting
UIElement.DragEnter
UIElement.DragLeave
UIElement.DragOver
UIElement.Drop
UIElement.DropCompleted
UIElement.KeyDown
UIElement.KeyUp
UIElement.DataContextChanged

Remarks

This control serves as a unified video rendering surface across all Uno Platform targets:

  • Windows: Native WinUI 3 rendering with DirectX
  • Android: TextureView-based rendering with hardware acceleration
  • iOS: Metal-based rendering via native UIView
  • macCatalyst: Metal-based rendering optimized for macOS
  • WebAssembly: HTML5 canvas or video element rendering
  • Skia: SkiaSharp-based software or hardware rendering (Linux, macOS, etc.)

The control integrates with VisioForge media engines through the VisioForge.Core.Types.IVideoView interface, providing consistent video playback APIs across all platforms. It handles platform-specific initialization through partial methods that are implemented in platform-specific files.

Key features:

  • Automatic DPI scaling on Windows
  • Mouse/pointer event handling (except on Android and iOS)
  • Minimum size enforcement for reliable rendering
  • Platform-specific optimizations via partial methods
  • Thread-safe UI updates via DispatcherQueue

Constructors

VideoView()

Initializes a new instance of the VisioForge.Core.UI.Uno.VideoView class.

public VideoView()

Remarks

The constructor performs the following initialization:

  • Sets black background for standard video display appearance
  • Subscribes to lifecycle events (Loaded, Unloaded, SizeChanged)
  • Subscribes to pointer events on supported platforms (not Android/iOS)
  • Ensures DispatcherQueue is available for thread-safe operations
  • Sets minimum size constraints to ensure proper rendering

Platform-specific initialization is performed when the control is added to the visual tree via the Loaded event, which calls the partial method OnLoadedPlatform().

Methods

CallInvoke(Delegate, params object[])

Executes a delegate on the UI thread of the control.

public void CallInvoke(Delegate method, params object[] args)

Parameters

method Delegate

The delegate to execute.

args object[]

The arguments to pass to the delegate.

CallRefresh()

Forces the view to redraw or refresh its content.

public void CallRefresh()

ClearUI()

Clears the user interface, removing any overlays or graphics.

public void ClearUI()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Remarks

This method performs comprehensive cleanup:

  • Unsubscribes from all lifecycle events (Loaded, Unloaded, SizeChanged)
  • Unsubscribes from pointer events on supported platforms
  • On Windows: Detaches from parent media engine and unsubscribes from its events

The method is safe to call multiple times. After disposal, the control should not be used.

~VideoView()

Finalizer.

protected ~VideoView()

GetBackgroundColor()

Gets the background color of the video view.

public SKColor GetBackgroundColor()

Returns

SKColor

The background color as an SkiaSharp.SKColor.

Remarks

This method safely accesses the Background property from any thread by marshalling to the UI thread if necessary. If the DispatcherQueue is available and the call is not from the UI thread, the method synchronously waits for the result.

GetHandle()

Gets the native window handle of the underlying UI control.

public nint GetHandle()

Returns

nint

An IntPtr representing the window handle.

GetInvokeRequired()

Gets a value indicating whether the caller must use an invoke method when making calls to the control.

public bool GetInvokeRequired()

Returns

bool

true if the call must be invoked; otherwise, false.

GetIsHandleCreated()

Gets a value indicating whether the underlying UI control's handle has been created.

public bool GetIsHandleCreated()

Returns

bool

true if the handle is created; otherwise, false.

GetSize()

Gets the current size of the video view.

public Size GetSize()

Returns

Size

The size as a VisioForge.Core.Types.Size structure.

Remarks

This method returns the control's size with platform-specific adjustments:

  • Uses ActualWidth/ActualHeight if available, falls back to Width/Height
  • On Windows: Applies DPI scaling to convert from logical pixels to device pixels
  • On other platforms: Returns logical pixels directly

The returned size is always at least 1x1 pixels and is rounded to integers. If DPI information cannot be retrieved on Windows, a scale of 1.0 (96 DPI) is assumed.

GetUIEngine()

Gets the underlying UI engine being used by the view.

public VideoViewUIEngine GetUIEngine()

Returns

VideoViewUIEngine

The VisioForge.Core.Types.VideoViewUIEngine used for rendering.

InvokeStart()

Signals the view that the engine has started.

public void InvokeStart()

Remarks

This method prepares the control for video rendering:

  • Sets control visibility to Visible
  • Calls the platform-specific start hook (OnInvokeStartPlatform)

The operation is performed on the UI thread to ensure thread safety. Platform-specific implementations handle additional initialization via the OnInvokeStartPlatform partial method.

InvokeStartComplete()

Signals the view that the engine has completed its start sequence.

public void InvokeStartComplete()

InvokeStop()

Signals the view that the engine has stopped.

public void InvokeStop()

Remarks

This method performs cleanup when video playback stops:

  • Keeps the control visible (unlike some platforms that hide it)
  • Forces a layout update to ensure proper display
  • Calls the platform-specific stop hook (OnInvokeStopPlatform)

The operation is performed on the UI thread to ensure thread safety. Any exceptions during layout update are caught and logged to debug output.

InvokeVideoRendererUpdate()

Triggers an update of the video renderer.

public void InvokeVideoRendererUpdate()

LogDialogClear()

Clears all messages from the log dialog.

public void LogDialogClear()

LogDialogClose()

Closes the log dialog if it is open.

public void LogDialogClose()

LogDialogError(string)

Displays an error message in a dialog box.

public void LogDialogError(string msg)

Parameters

msg string

The error message to display.

PushMouseButtonDown(int, int, MouseButton)

Pushes a mouse button down event to the control.

public void PushMouseButtonDown(int x, int y, MouseButton button)

Parameters

x int

The x-coordinate of the mouse.

y int

The y-coordinate of the mouse.

button MouseButton

The mouse button that was pressed.

PushMouseButtonUp(int, int, MouseButton)

Pushes a mouse button up event to the control.

public void PushMouseButtonUp(int x, int y, MouseButton button)

Parameters

x int

The x-coordinate of the mouse.

y int

The y-coordinate of the mouse.

button MouseButton

The mouse button that was released.

PushMouseMove(int, int)

Pushes a mouse move event to the control for processing.

public void PushMouseMove(int x, int y)

Parameters

x int

The x-coordinate of the mouse.

y int

The y-coordinate of the mouse.

ResizeRoundTo(int)

Resizes the video view, rounding the dimensions to a specified value.

public void ResizeRoundTo(int round)

Parameters

round int

The value to round the dimensions to (e.g., 16).

SetHandle(nint)

Sets the native window handle. Used for embedding the video in a specific control.

public void SetHandle(nint handle)

Parameters

handle nint

The window handle.

ShowMessage(string)

Shows a message box to the user.

public MessageBoxResult ShowMessage(string message)

Parameters

message string

The message to display.

Returns

MessageBoxResult

A VisioForge.Core.Types.MessageBoxResult indicating which button the user clicked.

ShowMessageEx(string, string, MessageBoxDialogButtons)

Displays a message box with custom caption and buttons.

public MessageBoxResult ShowMessageEx(string message, string caption, MessageBoxDialogButtons buttons)

Parameters

message string

The message to display.

caption string

The caption of the message box.

buttons MessageBoxDialogButtons

The buttons to display in the message box.

Returns

MessageBoxResult

The result of the message box.

OnMouseButtonDown

Occurs when a mouse button is pressed down over the control.

public event EventHandler<MouseButtonEventArgs> OnMouseButtonDown

Event Type

EventHandler<MouseButtonEventArgs>

OnMouseButtonUp

Occurs when a mouse button is released over the control.

public event EventHandler<MouseButtonEventArgs> OnMouseButtonUp

Event Type

EventHandler<MouseButtonEventArgs>

OnMouseMoved

Occurs when the mouse pointer is moved over the control.

public event EventHandler<MouseMoveEventArgs> OnMouseMoved

Event Type

EventHandler<MouseMoveEventArgs>

PropertyChanged

Occurs when a property value changes.

public event PropertyChangedEventHandler PropertyChanged

Event Type

PropertyChangedEventHandler