8,834
社区成员
发帖
与我相关
我的任务
分享
<UserControl x:Class="Angma.Framework.Custom.Controls.Control.GeneralFormControl"
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"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="1366">
<!--引入资源样式文件-->
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/StyleLibrary;component/Styles/ControlStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<!--自定义弹出窗体框架-->
<Border BorderBrush="White" CornerRadius="0" BorderThickness="1,1,1,0">
<DockPanel>
<Grid DockPanel.Dock="Top" Background="LightBlue">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="55"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Image Width="35" HorizontalAlignment="Right" Source="pack://application:,,,/Angma.Framework.Custom.Controls;component/Resource/Image/form_title.png"/>
<Label Grid.Column="1" x:Name="label_title" Content="用户控件窗体标题" HorizontalAlignment="Left"/>
<Button Grid.Column="2" x:Name="btn_back" Click="btn_back_Click" ToolTip="返回" BorderThickness="0" Background="LightBlue" Width="Auto">
<Rectangle Width="45" Height="50" VerticalAlignment="Center">
<Rectangle.Fill>
<ImageBrush ImageSource="pack://application:,,,/Angma.Framework.Custom.Controls;component/Resource/Image/back_btn.png" Stretch="Fill"/>
</Rectangle.Fill>
</Rectangle>
</Button>
</Grid>
<!--表单详细内容-->
<Border x:Name="border_conent" DockPanel.Dock="Bottom"></Border>
</DockPanel>
</Border>
</UserControl>
<AdornerDecorator>
<ContentPresenter Content="{Binding Content}" />
</AdornerDecorator>
这样的方式来进行内容定义。这样在引用的时候 直接定义在usercontrol中定义要显示的内容,就像你最后“这是引用上面的控件方式” 叙述的那样。