Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Unable to set the visibility of the user control

$
0
0

Hi..I want to set the visibility to visible of the custom user control when a MediaEnded event fired. How to achieve this, I have no idea? I tried to set the visibility to visibility.visible to true but unable to display the customToolTip. I done anything wrong? I hope someone can guide me. Thanks in advance.

DisplayWindow.xaml     

<myToolTip:UserControl1 Visibility="Collapsed" x:Name="customToolTip" Width="468" Height="700"/>  

DisplayWindow.xaml.cs

 public void OnVideoEnd()
        {
            if (CanDisplay == true)
            {
                customToolTip.Visibility = System.Windows.Visibility.Visible;
                MessageBox.Show(customToolTip.IsVisible.ToString());
            }
        }

Draw.cs

 private MediaPlayer LoadVideoSource(string videoPath)
        {
            Uri url = new Uri(videoPath,   UriKind.RelativeOrAbsolute);
            mp = new MediaPlayer();

            mp.Open(url);
            mp.MediaEnded += mp_MediaEnded;
            return mp;
        }

        private void mp_MediaEnded(object sender, EventArgs e)
        {
            canDisplay = true;
            dw = new DisplayWindow(canDisplay);

            if (mp.Position == TimeSpan.Zero)
            {
                dw.OnVideoEnd();
            }
            
        }





Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>