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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:07:29+00:00 2026-06-06T19:07:29+00:00

I relised I have lots of models view models with those two properties public

  • 0

I relised I have lots of models view models with those two properties

public Visibility OkButtonVisibility
{
get{  return _OkButtonVisibility;}
set{ 
_OkButtonVisibility = value;
RaisePropertyChanged("OkButtonVisibility");
}

}

public Visibility CancelButtonVisibility
{
get{  return _CancelButtonVisibility;}
set{ 
_CancelButtonVisibility = value;
RaisePropertyChanged("CancelButtonVisibility");
}

}

I wanted to create attachable interface for them like this:

Interface IOKandCancelButtonsVM
{
 public Visibility OkButtonVisibility
{
get{  return _OkButtonVisibility;}
set{ 
_OkButtonVisibility = value;
RaisePropertyChanged("OkButtonVisibility");
}

}

public Visibility CancelButtonVisibility
{
get{  return _CancelButtonVisibility;}
set{ 
_CancelButtonVisibility = value;
RaisePropertyChanged("CancelButtonVisibility");
}

}

and have my viewmodels that use this to inherite them and another interfaces with proxy properties like this

class VM1:BaseVM,IOKandCancelButtonsVM,IOtherCommonPropertyVM
{ 

} 

but then I relaised my new interfaces don’t impliment INotifyChanged.
would it be a bad idea to haveIOKandCancelButtonsVM impliment INotifyChanged
and have VM1 explicitly impliment BaseVM?

I never dealt with class inheriting same interface twice and not sure what to do.

this is only an example less than half of the VMs use those I have a few hundred properties, many shared over dozens of screens. i need a more elegant solution than sticking all on thos into the BaseViewModel

  • 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-06T19:07:30+00:00Added an answer on June 6, 2026 at 7:07 pm

    You cannot have an implementation in your interface definition. This means that your IOKandCancelButtonsVM definition is incorrect.

    would it be a bad idea to have IOKandCancelButtonsVM impliment BaseVM

    Yes it would be a very bad idea – impossible in fact – interfaces cannot implement or extend classes.

    Since you asked for opinion on how to structure your code, I will also throw this out there: remove any reference to ‘visibility’ from your viewmodel. Do not return a System.Visibility value from your viewmodel.

    A viewmodel shouldn’t know anything about the view. The semantically correct way to do this is to simply return a flag from the viewmodel, and use a converter to change it to a Visibility value in the binding – there is even a ready made converter in the framework for doing this: BooleanToVisibilityConverter. Try to avoid any mention of UI related terms in your VM even if it is returning a bool – it is a good practice which leads to tighter and more disciplined code, using those names willy nilly will eventually lead to smelly code.

    I have a blog post which illustrates a nice approach to property change notifications: Streamlining property notifications in MVVM.

    Just to make it clear, I am advising that you get rid of any ideas you have about IOKandCancelButtonsVM interfaces, by all means include simple boolean properties on a base viewmodel that will be extended by many other viewmodels that will be bound to dialogs with OK/Cancel buttons.

    To diagram this in text it would look like this:

    YourBaseVm <– BaseVmUsedByDialogs <– SpecificDialogVm

    (note the italicising which indicates the class is abstract)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 3 JPanel, the first is the base panel and the other two
I have two feature branches: featureA and featureB. FeatureA is complete, but not merged
I have X number of pages, and I wish to set permissions for users
I have a fairly standard OLTP normalised database and I have realised that I
REVISED QUESTION : We have tracked this down to a custom add to cart
EDIT 2: I have just realised that my HTML is only displaying the artist
EDIT: my revised Entity relationship diagram A Student can have many contact times but
I have a code. But, due to my limited knowledge. i researched and realised
I followed RailsCasts authentication from scratch (http://railscasts.com/episodes/250-authentication-from-scratch-revised) using the bcrypt-ruby gem and have the
I have an abstract class called DatabaseRow that, after being derived and constructed, is

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.