ScatterView(scatterViewCoordinates)の可視性を変更する必要があるSurfaceRadioButtonがあります
まず、オブジェクトの可視性を変更することでした()
private void CoordinatesChecked(object sender, RoutedEventArgs e)
{
scatterViewCoordinates.Visibility = Visibility.Visible;
}
その後、XAMLコードを変更し、ScatterViewの名前をSurfaceRadioButtonのタグ値に含めました。
<s:SurfaceRadioButton Name="Coordinates" Content="Coordinates"
Checked="CoordinatesChecked" Tag="scatterViewCoordinates" />
ここで、SurfaceRadioButtonに含まれているTag値をScatterViewにキャストし、その後、Visibilityメソッドを呼び出そうとしました。
private void CoordinatesChecked(object sender, RoutedEventArgs e)
{
string senderName = ((SurfaceRadioButton)sender).Tag.ToString();
((ScatterView)senderName).Visibility = Visibility.Hidden;
}
そして、私はこのエラーを受け取ります
Cannot cast expression of type 'string' to type 'ScatterView'
この問題を解決するためのアイデアはありますか(これがMVVMの概念を尊重している場合でも私は今でもしていません:s)?
提案も歓迎します。