1
Vote

IsVisible exception

description

IsVisible can be set at design time but I have exception at runtime: "Operation is not valid due to the current state of the object" when I run my application with this property binded to a checkbox in my menu.

Binding definition:
<CheckBox IsChecked="{Binding IsVisible, ElementName=PanelScopeSelection}">Test</CheckBox>

Because "IsVisible" property works fine in designTime, it sounds like it is a bug.

Xaml excerpt:
        <xcad:LayoutRoot>
                <xcad:LayoutPanel Orientation="Horizontal">
                    <xcad:LayoutAnchorablePane DockWidth="400">
                        <xcad:LayoutAnchorable Title="Scope(s) selection" x:Name="PanelScopeSelection" IsVisible="True">
                            <scopeSelection:UserControlSelectStudyScope x:Name="ToolScopeSelection"/>
                        </xcad:LayoutAnchorable>
                    </xcad:LayoutAnchorablePane>

comments

EricOuellet wrote Jul 31, 2013 at 9:16 PM

I think the code is really not clean.

You have IsVisible and IsHidden ???
IsVisible Call Hide but Hide check the state of IsVisible ???

Perhaps you could have an internal boolean related field that will be also marked as serializable to be saved while serializing states. And used that internal state when showing up initially and used in "Show" and "hide" ?

NOTE: I'm using the latest source available on 213-07-30.

Thanks,
Eric

EricOuellet wrote Aug 1, 2013 at 2:30 PM

More precisions...

I don't understand why there is "Hide", "Show" and "IsVisible".

I think that is should lead to a hard to understand behavior.
Knowing that we can bind only to property, I can't see why you maintain 2 ways of doing something equivalent. I wonder also why "IsVisible" is not serializable ?

I could be in error but I think that "Show" and "Hide" should not be public.

I you do remove "Show" and "Hide" from public interface, I would check to ensure that serialization would not throw any exception for old serialized states of the dock.

I know if would break compatibility but in the name of easier learning/understanding/usage it could be acceptable :-) !

Thanks,
Eric