Solved

How to Programmatically switch DataContext / ObjectDataSource

Posted on 2010-11-15
1
816 Views
Last Modified: 2013-11-12
Hi.. I have  the following XAML

               
/<Control.DataContext>
    <ObjectDataProvider
  MethodName="CreateDummyPDFs"
  ObjectType="{x:Type searchViews:PDFViewModel}" />
/</Control.DataContext>

I need to write code to swithc the datacontext and have the controls on my page refresh.

I need to call another method on my ViewModel and 'rebind' / refresht the data in code ..

any ideas...

I've tried ths but doens't do anything  

   this.odpSearchViewer.MethodName = "CreatePDFs";
                this.DataContext = this.odpSearchViewer;
         

0
Comment
Question by:JElster
1 Comment
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 300 total points
ID: 34142717
this.DataContext = this.odpSearchViewer.CreatePDFs(), should work i think
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Save copy of document in Word 4 88
Excel Use VBA to get user's Mac Address for their computer 5 248
Problem to DocumentFormat 8 111
C# LINQ ForEach() question 6 54
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question