好。我已经在StackOverflow中尝试了几乎所有解决方案,但仍然无法找到答案。这就是我希望它看起来像它看起来的样子。我通过这样做欺骗了文本框:
<Border Margin="100,20,100,20" BorderThickness="1.5" CornerRadius="20,20,20,20" Background="#F7F7F7" BorderBrush="#CAC9CC" Height="32">
<Grid>
<TextBlock x:Name="TextBlockUsername" Text="username" Margin="10,5,0,0" FontWeight="Light"/>
<TextBox Margin="8,5,8,5" Background="Transparent" BorderBrush="Transparent" TextChanged="TextBoxUsername_TextChanged" SelectionBrush="Transparent"/>
</Grid>
</Border>
但显然选择边界刷只是破坏了幻觉。关于如何使其透明的任何想法?
答案 0 :(得分:2)
尝试为TextBox设置BorderThickness="0"
:
<TextBox Margin="8,5,8,5" Background="Transparent" BorderThickness="0" TextChanged="TextBoxUsername_TextChanged" />