Solved

How to Programmatically switch DataContext / ObjectDataSource

Posted on 2010-11-15
1
803 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
Comment Utility
this.DataContext = this.odpSearchViewer.CreatePDFs(), should work i think
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now