I am using caliburn micro, and wanted to toggle visibility of 2 controls. Below is my xaml implementaion, In constructor if I set the property values to true/false , the controls are displayed/hidden accordingly. But I change those properties in an event to true/false which is not reflecting in the visibility of the controls. Below is how the properties are implemented. How the binding works in Constructor but not when i set it during an event.
private bool _bDisplayProjOutput;
private bool _bDisplayBrowseOutput;
public bool DisplayBrowseBtn
{
get { return _bDisplayBrowseOutput; }
set
{
_bDisplayBrowseOutput = value;
NotifyOfPropertyChange(() => DisplayBrowseBtn);
}
}
public bool DisplayFilesList
{
get { return _bDisplayProjOutput; }
set
{
_bDisplayProjOutput = value;
NotifyOfPropertyChange(() => DisplayFilesList);
}
}
<StackPanel Grid.Column="1" Grid.Row="1" Orientation="Vertical">
<StackPanel Orientation="Horizontal">
..
</StackPanel>
<StackPanel Orientation="Horizontal" Visibility="{Binding Path=DisplayBrowseBtn, Mode=TwoWay, Converter={StaticResource BoolToVis}}">
<TextBlock Text="Test Display" Margin="5"/>
</StackPanel>
<DataGrid ItemsSource="{Binding DocItemsList}" AutoGenerateColumns="False" IsReadOnly="False" CanUserAddRows="False"
VerticalScrollBarVisibility="Auto" Visibility="{Binding Path=DisplayFilesList, Mode=TwoWay, Converter={StaticResource BoolToVis}}">
<DataGrid.Columns>
..
</DataGrid.Columns>
</DataGrid>
</StackPanel>