I have a couple of views that I display as overlays on the main window by binding the visibility to a boolean property in my ViewModel.
The main window looks something like this:
<Grid>
<vw:MainContentView/>
<!-- Overlays (normally invisible) -->
<vw:NotificationsView/>
</Grid>
The 'NotificationsView' has a style that looks like this:
<Style x:Key="NotificationsView" TargetType="UserControl">
<!-- snipped -->
<Style.Triggers>
<DataTrigger Binding="{Binding IsNotificationsViewVisible}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsNotificationsViewVisible}" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
I am wondering whether it might be preferable to use a Popup with the 'IsOpen' property bound to the 'IsNotificationViewVisible' property in the ViewModel, rather than toggling the visibility of the view directly:
<Grid>
<vw:MainContentView />
<!-- Popups (normally invisible) -->
<Popup IsOpen="{Binding IsNotificationsViewVisible}">
<vw:NotificationItemsView/>
</Popup>
</Grid>
Are there any reasons I'd want to use one approach over the other (memory usage or otherwise)? Both approaches seem to work just fine - the Popup comes with a couple of free animations but otherwise looks the same.