0
Answer

how to display xml returned image into windows phone app

srujana gudla

srujana gudla

12y
1.1k
1
Hi,
 I can able to display  the data but I am unable to display the image ,

all the data from xml is displayed properly except image,

If anybody know the answer please help me in this,

                                                               

  private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {


              string loginid = MainPage.name;



            ServiceReference2.EST_WebServicesSoapClient client = new ServiceReference2.EST_WebServicesSoapClient();
            client.GetEmployeeDetails_LoginIdCompleted += new EventHandler<ServiceReference2.GetEmployeeDetails_LoginIdCompletedEventArgs>(client_GetEmployeeDetails_LoginIdCompleted);
            client.GetEmployeeDetails_LoginIdAsync(loginid);

        }

        private void client_GetEmployeeDetails_LoginIdCompleted(object sender, ServiceReference2.GetEmployeeDetails_LoginIdCompletedEventArgs e)
        {
            XElement xmlNews = XElement.Parse(e.Result.ToString());


            Institute trubyte=new Institute();




            textBlock2.Text = "Welcome  " + xmlNews.Element("FirstName").Value;
   trubyte.AuthorImage = GetImage(xmlNews.Element("Staff_Image").Value);

//image1.Source = GetImage(xmlNews.Element("Staff_Image").Value);

            t.Text = xmlNews.Element("Name").Value;

            t5.Text = xmlNews.Element("Gender").Value;

            textBlock5.Text = xmlNews.Element("Age").Value;

            t2.Text = xmlNews.Element("SchoolName").Value;
            t1.Text = xmlNews.Element("SchoolTrackId").Value;
            t4.Text = xmlNews.Element("Contact_No").Value;
         t3.Text= xmlNews.Element("Email_Id").Value;

        }

        private void textBlock3_MouseEnter(object sender, MouseEventArgs e)
        {
            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
        }


        public ImageSource GetImage(string path)
        {
            return new BitmapImage(new Uri(path, UriKind.Relative));
        } 

xaml:


                <Image Height="131" HorizontalAlignment="Left" Margin="6,194,0,0" Source="{Binding AuthorImage }" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="95" />