Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9310111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T01:01:51+00:00 2026-06-19T01:01:51+00:00

I have problem with DataContext in Windows Phone 8 project. When I run project

  • 0

I have problem with DataContext in Windows Phone 8 project. When I run project and MainPage() is done – I see 1st GIF, but when I go Button_Click_1 – 1st GIF is still visible. I have no idea how DataContext work. Is there any way to set DataContext again and display 2nd GIF?

namespace PhoneApp1
{
    public partial class MainPage : PhoneApplicationPage
    {

        public Uri ImageSource { get; set; }
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            ImageTools.IO.Decoders.AddDecoder<GifDecoder>();
            ImageSource = new Uri("http://c.wrzuta.pl/wi7505/bcd026ca001736004fc76975/szczur-piwo-gif-gif", UriKind.Absolute);
            this.DataContext = this;
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {

            ImageSource = new Uri("http://0-media-cdn.foolz.us/ffuuka/board/wsg/image/1338/94/1338947099997.gif", UriKind.Absolute);
            this.DataContext = this;
        }


    }
}

XAML

<imagetools:AnimatedImage x:Name="Image" Source="{Binding ImageSource, Converter={StaticResource ImageConverter}}" Margin="43,0,50,257" />
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T01:01:53+00:00Added an answer on June 19, 2026 at 1:01 am

    You will want to implement INotifyPropertyChanged so the Xaml knows of the changes to the ImageSource property.

    Example:

    public partial class MainPage : PhoneApplicationPage, INotifyPropertyChanged
    {
        private Uri _imageSource;
        public Uri ImageSource
        {
            get { return _imageSource; }
            set { _imageSource = value; NotifyPropertyChanged("ImageSource"); }
        }
    
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            ImageTools.IO.Decoders.AddDecoder<GifDecoder>();
            this.DataContext = this;
            ImageSource = new Uri("http://c.wrzuta.pl/wi7505/bcd026ca001736004fc76975/szczur-piwo-gif-gif", UriKind.Absolute);
        }
    
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            ImageSource = new Uri("http://0-media-cdn.foolz.us/ffuuka/board/wsg/image/1338/94/1338947099997.gif", UriKind.Absolute);
        }
    
        public event PropertyChangedEventHandler PropertyChanged;
        /// <summary>
        /// Notifies the property changed.
        /// </summary>
        /// <param name="property">The property.</param>
        private void NotifyPropertyChanged(string property)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a sample windows phone 7 project where I test some MVVM stuff,
Please assist with MVVM design/understanding problem. Given that we have a Windows Phone app
i'm moving from windows form to wpf but now i have a problem. i
I have a question regarding a problem with L2S, Autogenerated DataContext and the use
I have problem SIMILAR to preventing form data reposting, but not quite the same
I have got a problem. I have windows forms application with dynamic generated layout,
I have some problem to access the Window's DataContext from within a DataGrid. The
I have run into a problem with a custom wpf splash-screen implementation. The problem
I think the following picture describes the problem well enough. In my windows phone
This may sound trivial but i have a problem with setting selected item in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.