Ah, these things always appear simple until you think about them a bit more.
A wild guess but maybe this design is in anticipation that there will be another value. Visible Collapsed *Invisible* Collapsed and invisible aren't the same (e.g. An invisible cardboard box and a collapsed one are different. The invisible one still takes up the same space as the visible one while the collapsed one doesn't take up any space). This illustrates my point. <StackPanel> <Button x:Name="btn1" Content="Hello World"/> <Button x:Name="btn2" Content="Hello World 2" Visibility="Collapsed" /> <Button x:Name="btn3" Content="Hello World 3" Opacity="0"/> <Button x:Name="btn4" Content="Hello World 4"/> </StackPanel> btn2 takes up no space as it is collapsed while btn3 is invisible but still takes up space. So at the moment Invisible can be achieved by setting the Opacity to 0 but in the future they may add another value to the enum for this. My 2c. On Fri, Mar 12, 2010 at 9:37 AM, Mark <markspambus...@gmail.com> wrote: > Yeah, I've thought about this too. I use a converter and so the View Model > can just use a bool, but it does seem like an unnecessary step. > > -----Original Message----- > From: ozsilverlight-boun...@ozsilverlight.com > [mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of > ton...@tpg.com.au > Sent: Friday, 12 March 2010 11:31 a.m. > To: ozsilverlight@ozsilverlight.com > Subject: The verboseness of Visibility > > Hi all, > > Does anyone else get annoyed at the extra hastle required to set and bind > the Visibility property? > > I mean, how easy was it in the "old days" to simply set IsVisible=true or > IsVisible=false? You didn't > need a Visibility to Bool converter, which is extra unneccessary > processing, > and an extra point of > failure if it's forgotten, and more text to make mistakes. > > I mean, come on, there are only two states. There will never be a third > state. Instead of writing in > my code: > > TermTextBox.IsVisible = MyBoolVar; > > I have to write something like: > TermTextBox.Visibility = (MyBoolVar ? Visibility.Visible : > Visibility.Collapsed); > > Does it somehow give it extra contextual meaning for all the extra effort? > No. > > Can there be a third state, somehow semi-visible. No - that would be > handled > via an opacity or > animation. > > There is only a single meaning! > > It's Friday, bring it on! > > Regards, > Tony > > _______________________________________________ > ozsilverlight mailing list > ozsilverlight@ozsilverlight.com > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight >
_______________________________________________ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight