Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Re: Problems with Switching Images in XAML

 
 
Old 01-10-2006   #1 (permalink)
Wolf Schmidt [MSFT]


 
 

Re: Problems with Switching Images in XAML

Can't put a URI directly into Image.Source (at least not in code). There's an
intermediate practical ImageSource you have to use as well as a URI ctor.
Have to use something like:

CurrentImage.Source=new System.Windows.Media.Imaging.BitmapImage(new
Uri("file://c:\\msdn_masthead_ltr.gif"));

"Jason" wrote:

> Thanks...
>
> I didn't want to go the whole DataBinding route (right now..), as I'm
> learning the ropes as to what WPF can do.. But thanks! I realized my error
> as well, but I'll be taking this info with me.
>
> -J
>
>
>
> "MueMeister" <mue@gmx.de> wrote in message
> news:%23pdAhdD9FHA.3996@TK2MSFTNGP10.phx.gbl...
> > Hi Jason,
> >
> > Don't know whether I got Your problem but it sounds like the Master-Detail
> > scenario?!
> > Beatriz has an helpful article addressing this issue:
> >
> > http://www.beacosta.com/Archive/2005...a_archive.html
> >
> > Perhaps data binding could solve such scenarios in a better way than
> > providing handlers in code.
> > If you provide data binding to update dependencies between different
> > controls You have to declare the DataContext on a level which is parent of
> > the participating controls.
> > DataBinding also allows You to attach Converters which can for example
> > convert a String to an Image.Source.
> >
> > Chris
> >
> > Jason wrote:
> >> Morning...
> >> I'm having some trouble dynamically switching images in XAML, and didn't
> >> know if anyone could help.
> >>
> >> I have a listBox and an Image declared in XAML. I don't think I can use a
> >> trigger on this, since they aren't part of the same control heirarchy
> >> (Meaning, they're part of the same window, but not linked together).. I
> >> was planning on having a C# event handler to handle the listbox
> >> selectedIndexChanged() event and then switch the source. However, it will
> >> not let me put in a new path int the Image.Source property (as in,
> >> putting in a String).
> >>
> >> Does anyone have any suggestions?
> >>
> >>

>
>


My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
switching user problems, needs help plz General Discussion
Problems while switching users Vista General
Is it possible to include XAML files into another XAML file? .NET General
Problems switching from broadband back to LAN Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46