CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2010
    Posts
    3

    Data binding maybe?

    I have a program that has to WPF Windows.

    In the first MainWindow I have a menu to open a an image file.

    The menu opens an OpenDialog box to let the user choose an image, after the image is chosen an instance of the second WPF Window ImageWindow is created and the title is changed to the file path of the selected file

    string filename = dlg.FileName;
    Window imgWindow = new CToolsImageWindow();


    // Change Image window to filename of image
    imgWindow.Title = filename;
    imgWindow.Show();

    On the ImageWindow there is a Image Control named imgPicture, I want to change the imgPicture.Source to the file that was selected in the OpenDialog window, however I cannot access the imgPicture from the scope of MainWindow.

    Does this require data binding or a simple access modifier or ? I changed the XAML to FieldModifier="public" for the imgPicture and nothing.

    Am I making a gross conceptual error or what. I've spent hours trying to figure this out with no luck.

  2. #2
    Join Date
    Jul 2010
    Posts
    3

    Re: Data binding maybe?

    It's the same question as this guy asked http://stackoverflow.com/questions/2...-window-in-wpf

    But none of the solutions given work, I am not using the classname to try to access the controls property, I am using the new instance i created.

    I tried encapsulating it into a method in the Image window but i can't access the method from the MainWindow either.

    This is probably very easy but I feel like I have tried everything.

  3. #3
    Join Date
    Jul 2010
    Posts
    3

    Re: Data binding maybe?

    Finally, I solved this problem i was doing Window imgWindow = new ImageWindow(); instead of var imgWindow = new ImageWindow();


    Maybe that will help someone else in the future.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured