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,所以你可以看到发生了什么。