Click here to Skip to main content
15,891,607 members
Home / Discussions / WPF
   

WPF

 
QuestionWPF "Skinning" Pin
Steve The Plant2-Apr-09 10:23
Steve The Plant2-Apr-09 10:23 
AnswerRe: WPF "Skinning" Pin
Pete O'Hanlon3-Apr-09 4:01
mvePete O'Hanlon3-Apr-09 4:01 
GeneralRe: WPF "Skinning" Pin
Steve The Plant3-Apr-09 4:10
Steve The Plant3-Apr-09 4:10 
GeneralRe: WPF "Skinning" Pin
Pete O'Hanlon3-Apr-09 4:18
mvePete O'Hanlon3-Apr-09 4:18 
QuestionWPF Printing Fuzzy Pin
JensMig2-Apr-09 10:19
JensMig2-Apr-09 10:19 
QuestionXmlDataProvider Pin
mikla5212-Apr-09 6:13
mikla5212-Apr-09 6:13 
AnswerRe: XmlDataProvider Pin
hb521342142-Apr-09 11:37
hb521342142-Apr-09 11:37 
AnswerRe: XmlDataProvider Pin
Pete O'Hanlon2-Apr-09 22:18
mvePete O'Hanlon2-Apr-09 22:18 
If you don't want to go the whole MVVM route, a simple fix is to use a ValueConverter here. Consider the following sample converter code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace SampleWpfApplication
{
  public class SimpleImageConverter : IValueConverter
  {

    #region IValueConverter Members

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      Uri uri = new Uri(value.ToString(), UriKind.Absolute);
      BitmapImage img = new BitmapImage(uri);
      return img;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
      throw new NotImplementedException();
    }

    #endregion
  }
}
To use the converter, you add a reference to it in your Resources
section:<local:SimpleImageConverter x:Key="MyConverter" />
Finally, you bind to it using:<Image Source="{Binding ImageItem, Converter={StaticResource MyConverter}}" />It's that simple.

"WPF has many lovers. It's a veritable porn star!" - Josh Smith

As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.


My blog | My articles | MoXAML PowerToys | Onyx



AnswerRe: XmlDataProvider Pin
ABitSmart2-Apr-09 23:28
ABitSmart2-Apr-09 23:28 
GeneralRe: XmlDataProvider Pin
mikla5215-Apr-09 1:45
mikla5215-Apr-09 1:45 
QuestionWhy does WPF ignore stuff? Pin
RugbyLeague2-Apr-09 4:09
RugbyLeague2-Apr-09 4:09 
AnswerRe: Why does WPF ignore stuff? Pin
Pete O'Hanlon2-Apr-09 4:42
mvePete O'Hanlon2-Apr-09 4:42 
GeneralRe: Why does WPF ignore stuff? Pin
RugbyLeague2-Apr-09 4:46
RugbyLeague2-Apr-09 4:46 
AnswerRe: Why does WPF ignore stuff? Pin
Mark Salsbery2-Apr-09 5:35
Mark Salsbery2-Apr-09 5:35 
GeneralRe: Why does WPF ignore stuff? Pin
RugbyLeague2-Apr-09 5:39
RugbyLeague2-Apr-09 5:39 
GeneralRe: Why does WPF ignore stuff? Pin
Mark Salsbery2-Apr-09 5:49
Mark Salsbery2-Apr-09 5:49 
GeneralRe: Why does WPF ignore stuff? Pin
RugbyLeague2-Apr-09 5:51
RugbyLeague2-Apr-09 5:51 
QuestionUse .XAP file in ASP.Net Website Pin
pavanip2-Apr-09 2:42
pavanip2-Apr-09 2:42 
AnswerRe: Use .XAP file in ASP.Net Website Pin
Mark Salsbery2-Apr-09 5:21
Mark Salsbery2-Apr-09 5:21 
QuestionWPF codes to play a RTSP multicast or unicast video stream Pin
jklanka1-Apr-09 21:48
jklanka1-Apr-09 21:48 
QuestionKeep element in canvas when dragging it Pin
Pauwels Bart1-Apr-09 20:19
Pauwels Bart1-Apr-09 20:19 
AnswerRe: Keep element in canvas when dragging it Pin
ABitSmart1-Apr-09 21:17
ABitSmart1-Apr-09 21:17 
QuestionRe: Keep element in canvas when dragging it Pin
Pauwels Bart1-Apr-09 23:30
Pauwels Bart1-Apr-09 23:30 
AnswerRe: Keep element in canvas when dragging it Pin
ABitSmart2-Apr-09 5:05
ABitSmart2-Apr-09 5:05 
QuestionRe: Keep element in canvas when dragging it Pin
Pauwels Bart2-Apr-09 7:22
Pauwels Bart2-Apr-09 7:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.