Solved

How to Programmatically switch DataContext / ObjectDataSource

Posted on 2010-11-15
1
819 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 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