【发布时间】:2011-12-16 15:16:10
【问题描述】:
View 有一个按钮和 Image 控件。我已将按钮命令绑定到 ViewModel 上的 delegateCommand,这会打开一个文件对话框供用户选择 Image。View 的上下文“对象”包含一个属性“Icon”这是字节[]类型。我已将图标绑定到图像控件。问题是如何在图像控件上显示选定的图像文件?。
Xaml:
<Button x:Name="dlgIconbtn" Command="{Binding OpenFileCommand}" Content="Choose Icon" MaxWidth="120" Grid.Row="3" Grid.Column="1" Margin="5"/>
<Image Grid.Row="3" Margin="5" Grid.Column="3" Source="{Binding AppItem.Icon,Converter={StaticResource imgConverter}}"
Width="25" Height="25"/>
【问题讨论】:
-
标签不会为您的标题添加任何内容。
标签: c#-4.0 silverlight-4.0 mvvm prism-4