【问题标题】:WPF put a group box in the middle or inside a user controlWPF 在用户控件的中间或内部放置一个组框
【发布时间】:2015-01-02 15:36:35
【问题描述】:

我有一个名为 Palabok 的用户控件:

<UserControl x:Class="NeocClinic.WPFSystem.Templatas.Palabok"
             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="300">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>

        <Button Grid.Column="0"></Button>
    </Grid>
</UserControl>

然后我将它实现到我的 WPF 窗口:

<Window x:Class="NeocClinic.WPFSystem.IrritantDetailsForm"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:windowsControls="clr-namespace:NeocClinic.WPFSystem.Templatas"
        Title="IrritantDetailsForm" Height="300" Width="300">
    <windowsControls:Palabok ></windowsControls:Palabok>
</Window>

我的问题是我想在将显示在 Palabok 用户控件的 Grid.Column="2" 中的窗口中添加一个组框(带有刺激物的个性化组件/控件)。然后我将对另一个 WPF 窗口使用相同的用户控件,但将图像控件放置到 Palabok 用户控件的 Grid.Column="2" 而不是组框,但我似乎可以将控件放在 Palabok 用户中控制。

【问题讨论】:

    标签: c# wpf xaml


    【解决方案1】:

    我认为你的 Control 应该继承自 ItemsControl

    请查看:http://drwpf.com/blog/category/item-containers/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-09
      • 1970-01-01
      • 2018-12-03
      • 2015-03-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多