Inuyasha
Topic Author
Posts: 1
Joined: 09 Jun 2017, 11:37

How to display a popup widget in Unity3D

14 Apr 2019, 04:58

Like MessageBox...
 
User avatar
sfernandez
Site Admin
Posts: 2991
Joined: 22 Dec 2011, 19:20

Re: How to display a popup widget in Unity3D

18 Apr 2019, 16:16

Hi,

If you mean a modal-like dialog the easiest the way to go is by covering the entire screen with a background that will prevent you from clicking the UI under the dialog.

You can have a UserControl for showing dialogs, something like this:
<UserControl x:Class="Game.Dialog"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Grid Background="#40000000"> <!-- this will cover the entire screen to prevent clicking the UI under the dialog -->
    ...
    <Border x:Name="Dialog" Background="{StaticResource DialogBgBrush}">...</Border>
  </Grid>
</UserControl>
And the root xaml can have a container on top of everything to show this kind of dialogs:
<UserControl
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Grid x:Name="LayoutRoot">...</Grid>
  ...
  <Grid x:Name="DialogLayer">...</Grid>
</UserControl>
Hope this helps.

Who is online

Users browsing this forum: DHSven, Google [Bot] and 37 guests