Recommended

Skip Navigation LinksHome / Search

Search

 
Results Per Page

Found 3 results for property changed.
Date between: <not defined> and <not defined>
Search in: News , Articles , Tips , Shows , Showcase , Books

Order by Publish Date   Ascending Title   Rating  

  • Great Features for MVVM Friendly Objects Part 1 - Introducing Property Change Behaviors

    0 comments  /  posted by  Silverlight Show  on  Jun 21, 2010 (11 hours ago)
    In the next article in this series about useful MVVM friendly features, Damon Payne introduces the idea of Property Change Behaviors. If you have missed the introduction part here it is: Great Features for MVVM Friendly Objects Part 0: Favor Composition Over Inheritance.

    So, we’ve created some basic functionality for iterating through an ordered list of interesting actions whenever a property value changes.  Based on the logic inside BindableType, if the property values are equal we would stop processing subsequent Property Change Behaviors for this instance by returning false from NotifyPropertyBehavior.

    In the next article we’ll start adding more useful and interesting features using the IPropertyChangedBehavior approach.



  • Creating a simple Voting control in Silverlight 2

    4 comments  /  posted by  Martin Mihaylov  on  Sep 29, 2008 (more than a year ago)

    Update:  The demo above is converted to Silverlight 2 RC0. The only thing you have to change in order to run the code under Silverlight RC0 is to place the generic.xaml in a folder called "Themes" in the project of the voting control. Everything else is compatible with the release candidate.

    During the progress of the Silverlight: Write and Win! contest - one has finished and in the end of September another one ended, we thought that it would be nice to create a simple Voting control in Silverlight that will host the poll for the articles in the contest. The custom control we've created is based on the ItemsControl and its items are also custom controls. The biggest advantage of this control is that it's independent on the type of the objects that you pass as ItemsSource. You just set which properties of your business object to be used as Text and as Value for the poll options. That way you don't have to change them according to the control. The control also has a simple progress bar that visualizes the percentage of the votes. 

    Source code

    Note: The source code that is available for download is the one used for the article. To create this demo and the voting control for the site I made some modifications to it. The reason I post the basic source code is that you may want to make your own modifications to the control - like allowing multiple votes or only one time voting, modifying the user experience and the styling, adding total votes and poll title, customizing the workflow in the control etc. If you are interested in the things I have modified, I'll gladly share them with you, otherwise you can easily make your own modifications.

    Read more ...
  • 0 comments  /  posted by  Denislav Savkov  on  Aug 29, 2008 (more than a year ago)

    When the value of a property is changed it should notify the bound objects that the property value has changed. You can do that by implementing changed event.

    C#

    public class Client
    {
        private string name;
        public event EventHandler NameChanged;
     
        public string Name
        {
            get
            {
                return this.Name;
            }
            set
            {
                if ( this.name == value )
                    return;
     
                this.name = value;
                this.OnNameChanged( EventArgs.Empty );
            }
        }
     
        protected virtual void OnNameChanged( EventArgs e )
        {
            if ( this.NameChanged != null )
                this.NameChanged( this, e );
        }
    }

    Note that the value is changed only if the new value is different. Thus we prevent the firing of the NameChanged event when the actual value is not changed.

    Alternative way is to implement INotifyPropertyChanged interface.

    That's it!


Help us make SilverlightShow even better and win a free t-shirt. Whether you'd like to suggest a change in the structure, content organization, section layout or any other aspect of SilverlightShow appearance - we'd love to hear from you! Need a material (article, tutorial, or other) on a specific topic? Let us know and SilverlightShow content authors will work to have that prepared for you. (hide this)