我有一个number
,如下所示:
SELECT
x.distributor_item_number,
x.mfg_item_number,
x.mfg_name,
x.distributor_product_description,
min(x.[LENGTH OF DESC])
INTO Product_Table
FROM [Product Table] AS x
INNER JOIN
(SELECT p.distributor_item_number,
max(p.[LENGTH OF DESC]) AS [MAX LENGTH]
FROM [Product Table] AS p
GROUP BY p.distributor_item_number) AS y ON (y.distributor_item_number = x.distributor_item_number) AND (y.[MAX LENGTH] = X.[LENGTH OF DESC])
GROUP BY x.distributor_item_number, x.mfg_item_number, x.mfg_name, x.distributor_product_description;
我按如下方式使用此CustomTextBox
:
<TextBox x:Class="StackOverflow.CustomUserControl.CustomTextBoxView"
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"
x:Name="MainTextBox"
mc:Ignorable="d">
<TextBox.Template>
<ControlTemplate>
<Grid>
<ScrollViewer x:Name="PART_ContentHost"
Margin="0,0,0,5"
Panel.ZIndex="1" />
<Border CornerRadius="2"
Name="BorderToChange"
BorderThickness="0,0,0,3.7"/>
<TextBlock Text="{Binding ElementName=MainTextBox, Path=HintText}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground"
Value="Transparent" />
<Setter Property="Margin"
Value="0,0,0,3" />
<Setter Property="VerticalAlignment"
Value="Bottom" />
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</ControlTemplate>
</TextBox.Template>
在使用时,是否可以更改CustomTextBox
的{{1}}内名为{BorderToChange”的<customUserControl:CustomTextBoxView Width="50"
Height="50"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Text="{Binding Mode=TwoWay, Path=Period, UpdateSourceTrigger=PropertyChanged}"/>
元素的属性BorderThickness
?
我尝试了以下方法,但是没有用:
Border
答案 0 :(得分:2)
在模板中使用{TemplateBinding}
:
<Border CornerRadius="2" Name="BorderToChange" BorderThickness="{TemplateBinding BorderThickness}"/>
...并指定默认值:
<TextBox x:Class="..." BorderThickness="0,0,0,3.7"> ...
然后,您可以简单地将控件的BorderThickness
属性设置为覆盖默认值:
<customUserControl:CustomTextBoxView ... BorderThickness="1" ... />