WPF-如何在GridViewImageColumn中绑定图像

时间:2018-06-29 03:12:31

标签: c# wpf

我想知道如何在Telerik GridViewImageColumn中绑定图像。

这是我的XAML代码:

    <telerik:RadGridView Grid.Row="2" Grid.ColumnSpan="7" x:Name="GridView" GroupRenderMode="Flat"
                         RowHeight="63.4"
                         ItemsSource="{Binding DEP_GRID}"
                         IsFilteringAllowed="True"
                         CanUserFreezeColumns="False"
                         RowIndicatorVisibility="Collapsed"
                         AutoGenerateColumns="False"
                         IsReadOnly="True"
                         ShowGroupPanel="False"
                         FontSize="35"
                         FontFamily="NanumBarunGothic"
                         Foreground="Black"
                         Background="Transparent"
                         ShowColumnHeaders="False"
                         RowStyle="{StaticResource RadGridViewRowStyle}"
                         >
        <telerik:RadGridView.Columns>
            <telerik:GridViewImageColumn Width="0.2*" DataMemberBinding="{Binding FLTIDNF_IMG}" />
            <telerik:GridViewDataColumn  Width="0.2*"  DataMemberBinding="{Binding FLTIDNF}" />
            <telerik:GridViewDataColumn  Width="0.15*" DataMemberBinding="{Binding SCHDTIME}" TextAlignment="Center"/>
            <telerik:GridViewDataColumn  Width="0.45*" DataMemberBinding="{Binding CITY}" />
            <telerik:GridViewDataColumn  Width="0.15*" DataMemberBinding="{Binding LASTKNOWNTIME}" TextAlignment="Center"/>
            <telerik:GridViewDataColumn  Width="0.25*" DataMemberBinding="{Binding CHKINRANGE}" />
            <telerik:GridViewDataColumn  Width="0.15*" DataMemberBinding="{Binding KOR_NM}" />
        </telerik:RadGridView.Columns>
    </telerik:RadGridView>

                for (int i = 1 + (dep_screen_cnt - 1) * 14; i <= dep_screen_cnt * 14; i++)
                {
                    dr_dep = dt_dep.NewRow();
                    dr_dep["FLTIDNF_IMG"] = "logo01.bmp";
                    dr_dep["FLTIDNF"] = dt_ori.Rows[i]["FLTIDNF"].ToString();
                    dr_dep["SCHDTIME"] = dt_ori.Rows[i]["SCHDTIME"].ToString();
                    dr_dep["CITY"] = dt_ori.Rows[i]["CITY"].ToString();
                    dr_dep["LASTKNOWNTIME"] = dt_ori.Rows[i]["LASTKNOWNTIME"].ToString();
                    dr_dep["CHKINRANGE"] = dt_ori.Rows[i]["CHKINRANGE"].ToString();
                    dr_dep["KOR_NM"] = dt_ori.Rows[i]["KOR_NM"].ToString();
                    dt_dep.Rows.Add(dr_dep);
                }

我正在使用带有RadgridView DEP_GRID的MVVM模式和Datatable dt_dep绑定

其他列工作正常,但GridViewImageColumn不工作

logo01.bmp是项目文件夹中的测试图像

我不知道如何在GridViewImageColumn中绑定图像文件...

0 个答案:

没有答案