IsEnabled does not Work as expected

Nov 16, 2012 at 3:22 PM

Hi @all,

I am just starting with MVVM Light in Windows 8 and work my way through Command ect.

I'd like to enable/disable Buttons as required without collapsing. I implemented the following in ViewModel

        private bool _isEnabledAusWahlClick;
        public bool IsEnabledAuswahlClick
        {
            get { return _isEnabledAusWahlClick; }
            set
            {
                if (_isEnabledAusWahlClick==value)
                {
                    return;
                }
                _isEnabledAusWahlClick = value;
                RaisePropertyChanged("IsEnabledAuswahlClick");
            }
        }

When set to true, button appears, when set to false button disappears completely. Expected is, that Button cannot be clicked and is shown in a shaded layout.

Any suggestion what I did wrong?

Cheers

 

Coordinator
Nov 16, 2012 at 3:58 PM

Hi,

You don't provide much information. Anyway what is certain is that it is not an MVVM Light issue. Some buttons collapse when they are disabled (for example back button on a Win8 page) because the template specifies that in the disabled state. If you don't want this to happen, you have to edit the template in XAML or in Blend.

Thanks
Laurent

Nov 19, 2012 at 11:02 AM
Edited Nov 19, 2012 at 11:02 AM

Hi,

sorry for this beginners mistake. Actually I came from this post [discussion:255905] and was uncertain where to look at. In den meantime I found that it seems to work OK, but white on white is unvisible...

Thanks for our effort.

Josef