C# 当用户从对话框中选择图像时更新网格行单元格图像

C# 当用户从对话框中选择图像时更新网格行单元格图像,c#,wpf,C#,Wpf,我有一个图像和一个按钮并排在DevExpress网格中,当用户单击按钮时,我希望用户能够从文件对话框中选择一个新图像,该图像应立即显示在图像字段中。当用户更新行中的其余字段时,IPropertyChange事件应触发并存储该行。如何在WPF中实现这一点 XAML: 注意:我编写了从System.Windows.Forms.OpenFileDialog()获取文件的代码,并读取了一个字节[]中的文件以存储到数据库中。注意,最好在WPF.Noted中使用Microsoft.Win32.OpenFi

我有一个图像和一个按钮并排在DevExpress网格中,当用户单击按钮时,我希望用户能够从文件对话框中选择一个新图像,该图像应立即显示在图像字段中。当用户更新行中的其余字段时,IPropertyChange事件应触发并存储该行。如何在WPF中实现这一点

XAML:



注意:我编写了从System.Windows.Forms.OpenFileDialog()获取文件的代码,并读取了一个字节[]中的文件以存储到数据库中。注意,最好在WPF.Noted中使用
Microsoft.Win32.OpenFileDialog
。谢谢你的意见。你能详细解释一下吗?当用户更新IPropertyChange事件应触发的行中的其余字段时,您的意思是什么?
PropertyChanged
事件由
INotifyPropertyChanged
接口定义,该接口应由视图模型实现以更新视图。您希望您的视图触发该事件吗?
<dxg:GridColumn FieldName="Image" Header="Image" >
     <dxg:GridColumn.CellTemplate>
          <DataTemplate>
               <DockPanel>
                    <Image Source="{Binding RowData.Row.Image, Converter={StaticResource BinaryImageConverter}}" Width="100" />
                    <Button x:Name="BrowseFilePath" Height="20" Width="20" Content="..." Visibility="Hidden" CommandParameter="{Binding RowData.Row}" />
                    <!--<Button x:Name="BrowseFilePath" Height="20" Width="20" Content="..." Visibility="Hidden" Command="{Binding Source={x:Static local:FacilitiesBrowseImagePathDialog.BrowsePathCommand}}" CommandParameter="{Binding RowData.Row}"  />-->
               </DockPanel>
               <DataTemplate.Triggers>
                    <DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=dxg:GridRow}}" Value="True">
                         <Setter TargetName="BrowseFilePath" Property="Visibility" Value="Visible" />
                    </DataTrigger>
                </DataTemplate.Triggers>
            </DataTemplate>
       </dxg:GridColumn.CellTemplate>
 </dxg:GridColumn>