Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

New Post: updating ToggleButton IsEnabled property throws exception

$
0
0
hi,

I've created a simple tester where i use a button to enable/disable a ToggleButton

when the ToggleButton control does not contain anything - all works properly

however , adding sub controls to it (in our case i just added a StackPanel)- An exception is raised:

"Value does not fall within the expected range" - right after NotifyOfPropertyChange() is called

here is the problematic view i'm using:
<StackPanel>
            <ToggleButton x:Name="SayHello"  Grid.Column="1"  IsEnabled="{Binding HasValue}"  Height="190">
            <StackPanel x:Name="sp"> </StackPanel>
            </ToggleButton>
            <Button x:Name="Click"></Button>
         </StackPanel>
the view model:


private bool _hasvalue;
    public bool HasValue
    {
        get { return _hasvalue; }
        set
        {

                _hasvalue = value;
                NotifyOfPropertyChange(() => HasValue);
        }
    }

    public void Click()
    {
        HasValue = !HasValue;
    }

any way to workaround that one? - the platforms is WP8

thanks
ofer

Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>