我怎么能像这样制作TextBox

时间:2015-06-15 03:17:27

标签: windows xaml windows-phone-8

enter image description here

我如何在Windows Phone 8.1中制作像这样的TextBox

1 个答案:

答案 0 :(得分:1)

您可以创建一个UserControlImage的{​​{1}}。您需要声明TextBoxstring Text DependencyProperty数据绑定到。你的XAML看起来像这样:

string ImageSource DependencyProperty

如果您不熟悉创建<Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Image Source="{Binding ImageSource, RelativeSource={RelativeSource AncestorType={x:Type YourPrefix:YourUserControl}}}" /> <TextBox Grid.Column="1" Text="{Binding Text, RelativeSource={RelativeSource AncestorType={x:Type YourPrefix:YourUserControl}}}" /> </Grid> ,那么您可以在MSDN上的Custom Dependency Properties页面中了解如何操作。

相关问题