i need help with adding a custom property to a UserControl. I created a Video Player UserControl and i want to implement it in another application. I have a mediaElement control in my UserControl and i want to access mediaElement.Source from the app where will my UserControl be.
I tried this: [Player.xaml.cs]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace VideoPlayer
{
public partial class Player : UserControl
{
public static readonly DependencyProperty VideoPlayerSourceProperty =
DependencyProperty.Register("VideoPlayerSource", typeof(System.Uri), typeof(Player), null);
public System.Uri VideoPlayerSource
{
get { return mediaElement.Source; }
set { mediaElement.Source = value; }
}
public Player()
{
InitializeComponent();
}
I can't seem to find property in properties box. Any help about this?