Page 2 of 2

Re: Simulating modal dialog inside a view

Posted: 03 Jun 2019, 10:55
by sfernandez
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>

Re: Simulating modal dialog inside a view

Posted: 03 Jun 2019, 11:19
by whidbey
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