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 8446861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:02:05+00:00 2026-06-10T10:02:05+00:00

Could you please suggest an elegant way to check if a data on the

  • 0

Could you please suggest an elegant way to check if a data on the view has been modified to enable the Save button accordingly?

Thanks.

  • 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-10T10:02:07+00:00Added an answer on June 10, 2026 at 10:02 am

    Assuming you are using MVVM with Caliburn.micro, there is a Can-convention for commands. So, assuming you want to enable Save button if a string property named Username is non-empty, you simply add this method to the viewmodel:

    public bool CanSave()
    {
        if(String.IsNullOrEmpty(UserName))
            return false;
    
        return true;
    }
    

    Assuming your class inherits PropertyChangedBase or Screen, and you have a button with Name=”Save”, it will be disabled if UserName is empty. If you are interested in data changing in the view, the relevant property, in this example UserName, would of course have to be bound to some input area in the view – you could for instance have a TextBox named UserName which would make Caliburn set up the binding by convention.

    The class in its entirety would then look something like this:

    Edited to only allow saving of actually different data

    public class UserViewModel : PropertyChangedBase
    {
        private string _savedUserName;
    
        public string UserName{ get; set; }
    
        public bool CanSave()
        {
            return !UserName.Equals(_savedUserName);
        }
    
        public void Save()
        {
            //Save the data
    
            _savedUserName = UserName;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could please anybody suggest a way to deal with Inheritance regarding Page Objects pattern
could you please suggest me the way I could automatically resolve primary key conflicts
Could someone please suggest a good way of taking a global seed value e.g.
could you please suggest me (novice in Android/JAVA) what`s the most efficient way to
Could you please suggest the best way to hack the background-size issue with IE8
Could someone please suggest why this is happening... I’ve got some code to pretty
I am very new to Ruby so could you please suggest the best practice
Could you please check out this piece of code: #include <vector> class A {
Could you please suggest a simple SMTP server with the very basic APIs (by
Could you please suggest me the best possible answer to this question for a

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.