Image
最后更新于
这有帮助吗?
最后更新于
这有帮助吗?
The Image
control is a control for displaying raster images.
Binding onto an Image
control's Source
property with a string
must be done using a that will convert the string
to an IBitmap
.
An image button that changes images based on state is an example where binding to the Image
control's Source
property might seem necessary.
To have a button that swaps the image it's showing based on its state, you could either use a that converts a string
into a IBitmap
, or you could use the declarative approaches below, which don't use binding.
The declarative approaches keep images in memory and won't have to load them in on-demand, which will net you greater performance than a binding approach. You must declare every image you will use inside your XAML with the declarative approach.
Binding Converter Approach
Declarative Approaches
Using a Button
Using a ToggleButton
View the in the Button
documentation.
View the in the ToggleButton documentation.