Hi,@isa turgut.
You used <local:BasePage>
in UserControl1
, you could directly set the DataContext
for <local:BasePage>
.
UserControl1.xaml
<local:BasePage x:Name="MyBasePage">
...
<TextBlock x:Uid="txtBlock"
Text="{Binding Path=MyProperty, Mode=TwoWay}"
FontSize="50"
FontWeight="ExtraBold"></TextBlock>
...
</local:BasePage>
UserControl1.xaml.cs
public UserControl1()
{
InitializeComponent();
MyBasePage.DataContext = this;
this.Loaded += UserControl1_Loaded;
}
The result of clicking the button:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.