我希望我的TextBox
的角落有CornerRadius
= 12。我使用ControlTemplate
,一切都很好,但當我寫東西時,文本框中的文本顯示空格或點。如何正確使用WP7 Silverlight中的模板在TextBox中顯示文本?
下面是代碼:
<TextBox x:Name="UsernameTextBox" Text="{Binding Username, Mode=TwoWay}" Background="White" BorderBrush="#FF9ED3C1" >
<!--<TextBox.Text>
<Binding ElementName="username" ></Binding>
</TextBox.Text>-->
<TextBox.Template>
<ControlTemplate TargetType="TextBox">
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="12" Margin="12" >
<TextBox Text="{TemplateBinding Text}" Height="48" Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" />
</Border>
</ControlTemplate>
</TextBox.Template>
</TextBox>
我應該改變或其他的方式,我可以這樣做?
謝謝!)))))))))))))) – Vahan
不客氣:D –