1
我有这段代码在我page.xaml如何在xaml中使用应用样式实现双向数据绑定?
<TextBox x:Name="NameTextField" Grid.ColumnSpan="7" Grid.Column="1" Text="{Binding Name, Mode=TwoWay}" Style="{StaticResource TextBoxStyle}" />
它指的是这种风格:
<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Grid x:Name="grid" Height="55" Background="White">
<Rectangle Stroke="#FFD9D9D9" StrokeThickness="6"/>
<ContentPresenter x:Name="contentPresenterText" VerticalAlignment="Center" Margin="6,0" Height="42" >
<TextBox Text="{TemplateBinding Text}" FontSize="21.333" FontFamily="Arial" FontWeight="Bold"/>
</ContentPresenter>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
该工程确定从绑定时预填充数据,但似乎并不在数据输入时以另一种方式工作。
有什么明显的我在这里失踪?
非常感谢