これを使用して文字列をメインウィンドウからカスタムコントロールに渡す場合、カスタムコントロールでどのようにキャプチャしますか?
private void btnGeneral_Click(object sender, RoutedEventArgs e)
{
string myText = (string)Application.Current.Properties[textBox1.Text];
}
これを使用して文字列をメインウィンドウからカスタムコントロールに渡す場合、カスタムコントロールでどのようにキャプチャしますか?
private void btnGeneral_Click(object sender, RoutedEventArgs e)
{
string myText = (string)Application.Current.Properties[textBox1.Text];
}
それがあなたのやり方です:
//To Set:
App.Current.Properties["TextBoxString"] = textBox1.Text;
//To Get:
string myProperty = (string) App.Current.Properties["TextBoxString"];
WPFアプリケーションでのApplicationオブジェクトへのアクセスについては、この記事を確認してください。