0
我正在爲Windows Phone 8.1製作通用應用程序,並遇到了我的代碼問題。C#可見不起作用
在TextBlock值變得大於或等於22之後,一些圖像應該變爲可見。如果該值小於22,則所有圖像都不可見。
我的問題:我如何正文塊值> = 「22」 後獲得可見光圖像
這是我的代碼隱藏圖片:
private void points_Loaded(object sender, RoutedEventArgs e)
{
int n = 0;
bool b = int.TryParse(points.Text, out n);
DataContext = this;
ImageVis = (b && n >= 22) ? Visibility.Visible : isibility.Collapsed;
}
private Visibility imageVis;
public Visibility ImageVis
{
get { return imageVis; }
set
{
imageVis = value;
RaisePropertyChanged("ImageVis");
}
}
public event PropertyChangedEventHandler PropertyChanged = delegate { };
protected void RaisePropertyChanged(string propertyName)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
這部分代碼是從XAML:
<Image x:Name="hole17img"
HorizontalAlignment="Left"
Height="57"
Margin="10,3540,0,0"
VerticalAlignment="Top"
Width="380"
Source="Assets/septinpatsmit.png"
Stretch="Fill"
Visibility="{Binding ImageVis, Mode=TwoWay}"/>
我有一個問題:RaisePropertyChanged("ImageVis");
'RaisePropertyChanged'在當前上下文中不存在
這是否意味着我用這個名稱做了一些對象?或者是其他東西?
我可以提供我的My application,所以你可以看到發生了什麼。