Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7439645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:44:09+00:00 2026-05-29T10:44:09+00:00

Searched around and could not find a response for this. Does anybody know of

  • 0

Searched around and could not find a response for this. Does anybody know of a way to call a static method from a static class within XAML. I know that it is possible to call a static method from a regular class using ObjectDataProvider by doing something like:

<ObjectDataProvider x:Key="mthd" ObjectType="{x:Type l:MyClass}" MethodName="MyStaticMethod">
    <ObjectDataProvider.MethodParameters>
        <sys:String>Test</sys:String>
    </ObjectDataProvider.MethodParameters>
</ObjectDataProvider>

I have tried this with the static class and it fails. Since the static class cannot be instantiated with the exception of “Object reference not set to an instance of an object”.

Can something similar to this be done for static classes in .Net 4.0?
Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:44:10+00:00Added an answer on May 29, 2026 at 10:44 am

    Creating something like an ObjectDataProvide is really simple, you just need to use a bit of reflection. Get the class type via a Type property right from XAML along with the method name and parameters, then use GetMethod with the right BindingFlags and invoke it with the passed parameters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've searched around but I can't find any information about this; maybe I'm not
I searched around a bit, but could not find anything useful. Could someone help
I have searched around a lot for a solution, but could not find any.
I searched around but couldn't find an answer. I'm not sure if this is
I searched all around, but could not find any reasonable explanation. I found <%:
I searched around a little bit for information on this but didn't find anything
I have searched around Google and StackOverflow trying to find a solution to this,
I searched around and couldn't find the trunc function for C++. I know I
I searched on the web, but I could not find an appropriate description. I
I've searched around with this and haven't found any clear answers. I'm using Eclipse

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.