Kalpeshk9967 0 Newbie Poster

Hi,

This is my Second post here pls tolerate my english

I am making a WPF app with a media element i have added a media element a play button & a stop button bt when i start debugging the the process starts bt the app is not visible i mean it it visible in the taskbar even i can see the preview of the app in the taskbar (win7) but can't see the actual window below is my code see if i had done anything wrong there

PS. I m new to visual studio

the XML code

<Window x:Class="media_player.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="466.418" Width="665.299">
    <Grid>
        <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="Black" Offset="0"/>
                <GradientStop Color="#FF2B2727" Offset="1"/>
            </LinearGradientBrush>
        </Grid.Background>
        <MediaElement Name="mymedia" Source="E:\Restaurant [ 2006 ] - Sample.avi" Margin="10,10,10,59" LoadedBehavior="Manual" UnloadedBehavior="Stop" ></MediaElement>
        <Button Content="Play" Margin="10,377,568,19" Click="Button_Click_1" ></Button>
        <Button Content="Stop" Margin="107,377,471,19" Click="Button_Click_2"></Button>

    </Grid>
</Window>

& the CS part

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace media_player
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            mymedia.Play();
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            mymedia.Stop();
        }
    }
}

M i missing some thing or ?????

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.