访问TextBox的Altholdertext属性,并在页面/用户控制加载后将其设置为最初价值



我正在使用UWP应用程序,并且我已经实现了UserControl。用户控件具有多个Textboxes,并且USERCONTROL已在其他view页面中实现。我想确保每当查看页面加载时,所有的文本框都将Enter作为突出显示文本框时关闭的默认文本。

我的UserControl具有此实现

<UserControl >
 ---------------------------
----------------------------
<Border Grid.Row="1" Grid.Column="2" BorderBrush="{StaticResource brush}" BorderThickness="0,3,0,0" >
                <local:NumericTextBox x:Name="TaxifuelRevised"  IsEnabled="{Binding FuelPlanInfo.IsTappable}" Tag="TaxiFuelActual" TextAlignment="Right" Text="{Binding FuelPlanInfo.TaxiFuelActualInPreferredUnit,ElementName=rootFuelControl,Mode=TwoWay,UpdateSourceTrigger=Explicit}" 
                         Margin="0,0,40,0" Style="{StaticResource TransparentTextBox}" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="#FF0078D7" 
                         BorderBrush="{x:Null}" Background="{x:Null}" FontSize="40" FontFamily="Helvetica" InputScope="Number" 
                         KeyDown="TextBox_KeyDown" MaxLength="5" GotFocus="TextBox_GotFocus" LostFocus="TextBox_LostFocus" Tapped="KeyBoardInputScope_Tapped"  />

            </Border>
</UserControl>

实现的view

 <Pivot x:Name="MyPivot" Grid.Row="1" ManipulationMode="None" Margin="115,10,90,20" SelectionChanged="MyPivot_SelectionChanged" HorizontalAlignment="Stretch" Width="2536"  >
                                <PivotItem Tag="Fuel Plan" Margin="0" ManipulationMode="None">
                                <PivotItem.Header >
                                    <StackPanel >
                                        <Image Name="FuelPlanImage" Source="ms-appx:///Assets/fuel_plan_icon.png" Width="82" Height="80"></Image>
                                        <TextBlock Margin="0,8,0,0" TextAlignment="Center" Text="Fuel Plan"  FontSize="40"/>
                                    </StackPanel>
                                </PivotItem.Header>

                                    <local:FuelPlan x:Name="FuelPlanUC" HorizontalAlignment="Stretch" FuelPlanInfo="{x:Bind ViewModel.FuelPlanInfo, Mode=OneWay}"></local:FuelPlan>
                            </PivotItem>

检查textboxControl的loctholdertext属性。

最新更新