1
我想写的二手这样的自定义控件:WPF:自定义控制结合其内容的标签
<HorizontalTick>Some string</HorizontalTick>
它应该呈现这样的:
- 一些字符串--- ----------------------------------------
这里是我的代码:
<UserControl x:Class="WeatherDownloadDisplay.View.HorizontalTick"
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:DesignWidth="348"
Name="controlRoot">
<DockPanel LastChildFill="True">
<UserControl VerticalAlignment="Center" BorderBrush="Black" BorderThickness="1" Width="10"/>
<Label Content="???" />
<UserControl VerticalAlignment="Center" BorderBrush="Black" BorderThickness="1"/>
</DockPanel>
</UserControl>
它的工作除外为标签绑定。有人可以帮我填写问号吗?我想过使用ContentPresenter,但似乎内联绑定是最好的。
-Neal