Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <DataTemplate x:Key="imageThumb">
- <Image x:Name="docImage" Width="25" Height="25" Source="/MyApp;component/images/pdf-icon.png">
- <Image.Effect>
- <DropShadowEffect ShadowDepth="1" BlurRadius="1" Opacity="0.5"/>
- </Image.Effect>
- </Image>
- </DataTemplate>
- DataTemplate imageTemplate = (DataTemplate)this.Resources["imageThumb"];
- DataGridTemplateColumn docType = new DataGridTemplateColumn();
- docType.Header = "Doc Type";
- docType.CellTemplate = imageTemplate;
- targetDataGrid.Columns.Add(docType);
- <local:StringToObjectConverter x:Key="DocTypeToBitmap">
- <ResourceDictionary>
- <BitmapImage x:Key="pdf" UriSource="/MyApp;component/images/pdf-icon.png" />
- <!-- Other BitmapImages here -->
- <BitmapImage x:Key="__default__" UriSource="/MyApp;component/images/unknown-icon.png" />
- </ResourceDictionary>
- </local:StringToObjectConverter>
- <DataTemplate x:Key="imageThumb">
- <Image x:Name="docImage" Width="25" Height="25" Source="{Binding docType, Converter={StaticResource DocTypeToBitmap}}">
- <Image.Effect>
- <DropShadowEffect ShadowDepth="1" BlurRadius="1" Opacity="0.5"/>
- </Image.Effect>
- </Image>
- </DataTemplate>
- public BitmapSource ThumbnailBitmapSource {
- get {
- BitmapImage img = new BitmapImage(someUriYouGetBasedOnDocType);
- return img;
- }
- }
- partial void OnDocTypeChanged() {
- this.RaiseDataMemberChanged("ThumbnailBitmapSource");
- }
Add Comment
Please, Sign In to add comment