Creating a Converter to take an ID and create an Image in Silverlight

强颜欢笑 提交于 2019-12-02 08:19:52
  1. For the converter, you can do something like this:

    <sdk:DataGrid>

    <sdk:DataGrid.Resources>
        <local:WeatherIdToImageConverter key="IdToImageConverter" />
    </sdk:DataGrid.Resources>
    ...
        <sdk:DataGridTemplateColumn>
           <sdk:CellTemplate>
               <DataTemplate>
                   <Image Source="{Binding WeatherID, Converter={StaticResource IdToImageConverter}}" />
                   ...
    
  2. In your implementation of the converter, I would use the ImageTools library (http://imagetools.codeplex.com/) to convert between GIF and PNG (PNG will be better quality than JPEG).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!