Skip to content

Commit

Permalink
Added PointerEntered/Exited event handlers to sample
Browse files Browse the repository at this point in the history
  • Loading branch information
taivasverkko committed May 9, 2024
1 parent 9ed433b commit b095266
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions samples/LibVLCSharp.Avalonia.Sample/Views/VideoPlayer.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

<vlc:VideoView Grid.Row="1" MediaPlayer="{Binding MediaPlayer}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Panel>
VerticalAlignment="Stretch"
PointerEntered="VideoViewOnPointerEntered"
PointerExited="VideoViewOnPointerExited">
<Panel Name="ControlsPanel">
<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" Background="#900000FF" Spacing="20">
<Button Command="{Binding Play}" Margin="20">Play</Button>
<Button Command="{Binding Stop}" Margin="20">Stop</Button>
Expand Down
11 changes: 11 additions & 0 deletions samples/LibVLCSharp.Avalonia.Sample/Views/VideoPlayer.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using Avalonia.Controls;
using Avalonia.Input;
using LibVLCSharp.Avalonia.Sample.ViewModels;

namespace LibVLCSharp.Avalonia.Sample.Views
Expand All @@ -18,5 +19,15 @@ private void OnDataContextChanged(object sender, EventArgs e)
vm.Play();
}
}

private void VideoViewOnPointerEntered(object sender, PointerEventArgs e)
{
ControlsPanel.IsVisible = true;
}

private void VideoViewOnPointerExited(object sender, PointerEventArgs e)
{
ControlsPanel.IsVisible = false;
}
}
}

0 comments on commit b095266

Please sign in to comment.