[英]Which is the best way to access to object from another class ex.:MainPage.xaml.cs?
例如,我正在使用這種技術:
XAML
<Button x:Name="playButton" Content="Play with rabbit" With="20" Height="20"/>
MainPage.xaml.cs中
public Button _PlayButton
{
get { return playButton; }
}
PlayerControl.cs
//received instance of MainPage class to "_mainPage"
public Button Play
{
_mainPage._PlayButton.Content = "Who care about this text?";
//play logic
}
我正在尋找最佳實踐。 在哪里可以深入了解該范圍?
沒有最佳實踐。 這完全取決於您的要求。 我在各個地方使用過的方法來完成類似的任務:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.