1
如何更改txtPIN.Text UserControl初始化後的C#代碼後面的值。UWP [Xaml]如何訪問Button內部的元素
這裏是XAML
<Button x:Name="btn_pin" Content="Change PIN" Click="button_Click" Foreground="White">
<Button.Template>
<ControlTemplate TargetType="Button">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Image Source="/Assets/images/settings/lock.png" Stretch="UniformToFill" Width="16" Height="16"/>
<TextBlock x:Name="txtPin" Text="Change PIN" Foreground="White" />
</StackPanel>
</ControlTemplate>
</Button.Template>
</Button>
和C#
public MyUserControl()
{
this.InitializeComponent();
this.btn_pin.??????????
}
太棒了!它完全按照我們的需要工作。謝謝 ! –