WPF 中的DataTemplate 的嵌套
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WPF"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
content presentor 的使用
------------------------------------------------------------
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WPF"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" x:Name="uc">
C# code
-------------------------
public partial class Login : UserControl
{
public Login()
{
InitializeComponent();
this.Loaded += Login_Loaded;
this.DataContext = this;
}
private void Login_Loaded(object sender, RoutedEventArgs e)
{
}
public static readonly DependencyProperty MMProperty = DependencyProperty.Register("MM", typeof(object), typeof(Login));
public object MM
{
get { return (object)GetValue(MMProperty); }
set { SetValue(MMProperty, value); }
}
private static bool setV(Object obj)
{
// lab.Content = obj;
return true;
}
}
原文:https://www.cnblogs.com/bruce1992/p/14852697.html