不同的图标取决于TreeView中的文件类型WPF

时间:2015-07-30 16:07:43

标签: c# wpf xaml

我已经对此进行了调整,并且有一些信息TreeVIew InfoCode Project,它们之间非常有帮助。但我仍然只有相同类型的文件夹。

enter image description here

progress.show();
    AsyncHttpClient asyncHttpClient = new AsyncHttpClient();

    asyncHttpClient.get(String.format("url", ), new AsyncHttpResponseHandler() {

                @Override
                public void onFailure(Throwable arg0, String arg1) {
                    // TODO Auto-generated method stub
                    super.onFailure(arg0, arg1);
                    progress.dismiss();
                }
                @Override
                public void onSuccess(int statuscode, String messsage) {
                    // TODO Auto-generated method stub
                    super.onSuccess(statuscode, messsage);
                    progress.dismiss();
               }
          });
        }

这是我的WPF,我想我不知道什么或如何绑定到不同的文件类型。

谢谢你的帮助!

1 个答案:

答案 0 :(得分:2)

我没有看到datacontext或树视图的数据源,但您可以将Image控件的Source属性绑定到模型中包含图标的属性:

<Image Name="img"
Width="20"
Height="20"
Stretch="Fill"
Source="{Binding FolderIcon}"/>