I was correctly referencing the BooleanToVisibilityConverter as a static resource.
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVisiblity" />
</Window.Resources>
My binding was correctly set to the IsControlVisible property of my ViewModel.
<Grid Margin="0,30,0,0" Height="63" VerticalAlignment="Top"
Visibility="{Binding IsControlVisible,
Converter={StaticResource BoolToVisiblity}}">
<!--Content-->
</Grid>
The IsControlVisible property of my ViewModel seemed to be correct.
bool isControlVisible = false;
bool IsControlVisible {
get { return isControlVisible; }
set {
isControlVisible = value;
NotifyPropertyChanged("IsControlVisible");
} }
20 frustrating minutes later, I find the problem. 10 bonus points if you can spot it right away…
That’s right, I forgot to make the IsControlVisible property in my ViewModel public! *Face Palm*
bool isControlVisible = false; public bool IsControlVisible {
get { return isControlVisible; }
set { isControlVisible = value; NotifyPropertyChanged("IsControlVisible");
} }
Perhaps this can save someone else some time!
2 comments:
try Converter={StaticResource BooleanToVisiblity}}">
Thk U, that did me check and I just had that property as private.
Post a Comment