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 6024455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:09:28+00:00 2026-05-23T04:09:28+00:00

There are plenty of ways to bind a SOURCE method to target property, either

  • 0

There are plenty of ways to bind a SOURCE method to target property, either by ValueConverter or by ObjectDataProvider. However, what if I want to have the binding affect the target METHOD?

Consider the following example:

class ListBoxViewModel
{
        public static readonly DependencyProperty CurrentItemProperty = DependencyProperty.Register("CurrentItem", typeof (object), typeof (ListBoxViewModel));

        public object CurrentItem
        {
            get { return (object) GetValue(CurrentItemProperty); }
            set { SetValue(CurrentItemProperty, value); }
        }   
}

I’d like to bind the property CurrentItem to ListBox‘s CollectionView. However, since the CurrentItem property of CollectionView is read-only, I can’t bind to it directly. Instead, I have to execute MoveCurrentToPosition function. How can I do it?

If there is a different way to do that – Without binding to a method, I’d love to hear it too, however, the main question is how to bind to a method, if not in this case, then in a similar one. If it is impossible, what is the best alternative? E.g one idea that comes to mind is subscribing to the change notification of the dependency property (CurrentItem in this case) and running the procedural code from that function.

Thanks!

  • 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-23T04:09:28+00:00Added an answer on May 23, 2026 at 4:09 am

    You can register your property with a property changed callback in which you then can update the CollectionView manually:

    public static readonly DependencyProperty CurrentItemProperty =
        DependencyProperty.Register
        (
            "CurrentItem",
            typeof(object),
            typeof(ListBoxViewModel),
            new UIPropertyMetadata(null, CurrentItemChanged)
        );
    public object CurrentItem
    {
        get { return (object)GetValue(CurrentItemProperty); }
        set { SetValue(CurrentItemProperty, value); }
    }
    
    private static void CurrentItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        // Update current item logic
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that floating point calculations have accuracy issues and there are plenty of
there probably plenty of you here who have done secure payment forms in their
I know there are plenty of ways to run git on my server, but
Just a language feature question, I know there's plenty of ways to do this
As I have learned data structure, I know there are plenty of other data
There are plenty of articles on the web detailing why you might not want
There are plenty of questions on here related to fork() and exec(). I have
There are plenty of script/tools for counting line of code, and some to count
There's plenty of information on running Java apps as services, but I need to
There are plenty of PHP frameworks out there as many of you know, and

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.