Avatar of JElster
JElsterFlag for United States of America

asked on 

How to Programmatically switch DataContext / ObjectDataSource

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;
         

Microsoft Development

Avatar of undefined
Last Comment
Gautham Janardhan
ASKER CERTIFIED SOLUTION
Avatar of Gautham Janardhan
Gautham Janardhan

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft Development
Microsoft Development

Most development for the Microsoft platform is done utilizing the technologies supported by the.NET framework. Other development is done using Visual Basic for Applications (VBA) for programs like Access, Excel, Word and Outlook, with PowerShell for scripting, or with SQL for large databases.

48K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo