Solved

How to Programmatically switch DataContext / ObjectDataSource

Posted on 2010-11-15
1
817 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…

730 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