Reputation: 49
I want to control my image object is or is not null
. if(pictureBox.Image == null)
works C# but I cannot find a code for WPF. What should I write for this?
Upvotes: 1
Views: 762
Reputation: 69372
WPF doesn't have a PictureBox
control. The equivalent is Image
(as shown here), so you could just do this:
if(myImage.Source == null) ...
Unless you're doing something more complicated and hosting WinForm controls in WPF?
Upvotes: 1
Reputation: 172408
YOu can do this :-
private PictureBox p1= null;
Now you can set the value as null
p1= (PictureBox)image;
And finally you can use it as:-
if(p1 == null)
Upvotes: 1