将命名控件导入xaml

1、导入本地命名空间

<Window x:Class="DemoApplication.MainWindow"
    xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dc="clr-namespace:DemoApplication"
    Title="MainWindow" Height="300" Width="300">
    <Grid>
        <dc:DemoControl />
    </Grid>
</Window>

  如xmlns:dc="clr-namespace:DemoApplication"

2、导入第三方命名空间

<Window x:Class="DemoApplication.MainWindow"
    xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dc="clr-namespace:DemoApplication"
    xmlns:vc="clr-namespace:VendorControlLibrary;assembly=VendorControlLibrary"
    Title="MainWindow" Height="300" Width="300">
    <Grid>
        <dc:DemoControl />
        <vc:UserControl1 />
    </Grid>
</Window>

  如xmlns:vc="clr-namespace:VendorControlLibrary;assembly=VendorControlLibrary"

posted @ 2026-03-31 16:50  echo-efun  阅读(1)  评论(0)    收藏  举报