![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| 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 | |||