繁体   English   中英

定义标签和文本框的最佳方法是什么

[英]what is the best way to define label and TextBox

我可以通过定义将包含这两个元素的UserControl来实现。 但是可以通过定义新样式来定义它吗?

我想在附件的位图上定义类似的内容。 但是我需要在我的xaml上的很多地方进行此操作。

在此处输入图片说明

通过为HeaderedContentControl使用样式

    <HeaderedContentControl Header="Title" Content="what is the best way to define label and TextBox">
        <HeaderedContentControl.Template>
            <ControlTemplate TargetType="HeaderedContentControl">
                <StackPanel Orientation="Horizontal">
                    <Label Content="{TemplateBinding Header}"/>
                    <TextBox Text="{TemplateBinding Content}"/>
                </StackPanel>
            </ControlTemplate>
        </HeaderedContentControl.Template>
    </HeaderedContentControl>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM