Contents tagged with XAML

  • XAML simplification of usage INotifyPropertyChanged

    Hello,

    I want to share some code, wich can simplify usage of INotifyPropertyChanged in XAML.

    Take a loot at following fragments:

    Snippet

    namespace NotifyPropertyChanged

    {

        public class BindableBase : INotifyPropertyChanged 

        {

            public event PropertyChangedEventHandler PropertyChanged;

            public void RaisePropertyChanged(string propertyName)

            {

                if(PropertyChanged != null)

                {

                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));

                }

            }

        }

    }

    Class BindableBase now can become as base class for those objects, which need to notify UI about changes in source code. Consider … more

  • Binding modes in XAML

    Hello everybody,

    today I want to write few words about binding in XAML.

    So there are four ways of binding in XAML.

    One way

    Two way

    One way to source

    One time

    If to speak about them more, then here it goes additional definitions:

    OneWay : source property updates target property

    TwoWay: source or target updates the other

    OneWayToSource: source is updated when target is updated

    OneTime: executed only once for initialization of target property

    What is important to notice for notification of UI, there is a need for implementing INotifyPropertyChanged interface. Without it changes in source properties will not become propogated to target.

    more

  • Basic elements in XAML

    Hello everybody,

    today I want to write few words about basic elements in XAML.

    DependencyObject

    This class is next in inheritance level in XAML after object. DependencyObject gives needed properties for representing something that participates in dependency property system. Mostly needed for data binding. It is basic for UIElement, Geometry, FameworkTemplates, Tile, ResourceDictionary.

    UIElement

    This is base class for all objects that have visual representation. It supports basic manipulation, appereance, layout. Also it has code for responses for user input, routed events, some aspects of animation system.

    FrameworkElement

    This class takes part in layout and obliged to have … more