Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. From a Tip/Trick here on CP

From a Tip/Trick here on CP

Scheduled Pinned Locked Moved The Weird and The Wonderful
csharpwpfdesign
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marco Bertschi
    wrote on last edited by
    #1

    protected virtual bool SetProperty
    (ref T storage, T value, [CallerMemberName] string propertyName = null)
    {
    if (Equals(storage, value)) return false;

        storage = value;
        this.RaisePropertyChanged(propertyName);
        
        return true;
    }
    
    protected virtual bool SetPropertySafely
    (ref T storage, T value, \[CallerMemberName\] string propertyName = null)
    {
        if (Equals(storage, value)) return false;
        
        storage = value;
        this.RaisePropertyChangedSafely(propertyName);
        
        return true;
    }
    
    protected virtual bool SetPropertySafelyFast
    (ref T storage, T value, \[CallerMemberName\] string propertyName = null)
    {
        if (Equals(storage, value)) return false;
        
        storage = value;
        this.RaisePropertyChangedSafelyFast(propertyName);
        
        return true;
    }
    

    The topic is about making data changes visible ASAP on the UI (WPF) from another thread. Either all methods above are safe & fast, or all of them are slow and unsave. I tend towards the latter. :laugh:

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups