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

Re: Simulating modal dialog inside a view

03 Jun 2019, 10:55

Each UserControl is defined in separate xaml files, then you can reference them in any other xaml just by including an instance of the code-behind class:

MyUserControl.xaml
<UserControl x:Class="Testing.MyUserControl"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    ...
</UserControl>
MainWindow.xaml
<UserControl x:Class="Testing.MainWindow"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="clr-namespace:Testing">
    <Grid x:Name="LayoutRoot">
        ...
        <local:MyUserControl />
        ...
    </Grid>
</UserControl>
 
whidbey
Posts: 49
Joined: 26 May 2019, 07:16

Re: Simulating modal dialog inside a view

03 Jun 2019, 11:19

Each UserControl is defined in separate xaml files, then you can reference them in any other xaml just by including an instance of the code-behind class:

MyUserControl.xaml
<UserControl x:Class="Testing.MyUserControl"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    ...
</UserControl>
MainWindow.xaml
<UserControl x:Class="Testing.MainWindow"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="clr-namespace:Testing">
    <Grid x:Name="LayoutRoot">
        ...
        <local:MyUserControl />
        ...
    </Grid>
</UserControl>
ok,thanks

Who is online

Users browsing this forum: No registered users and 10 guests