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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:58:48+00:00 2026-05-30T03:58:48+00:00

A button’s Command is ExcelExportCommand and its CommandParameter is like: <Button x:Name=ExcelExport Grid.Row=1 Height=25

  • 0

A button’s Command is ExcelExportCommand and its CommandParameter is like:

<Button x:Name="ExcelExport" Grid.Row="1" Height="25" Width="100" Command="{Binding ExcelExportCommand}" CommandParameter="{Binding ElementName=ListTabControl, Path=SelectedIndex}">Export to Excel</Button>

How can i get the SelectedIndex through a ViewModel programmatically? I’m new to MVVM pattern and I want to verify that I had taken the right approach. Can you help?

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-30T03:58:49+00:00Added an answer on May 30, 2026 at 3:58 am

    You can bind the SelectedIndex property of your ListTabControl to an integer property in your viewmodel:

    <List x:Name="ListTabControl" SelectedIndex="{Binding ListSelectedIndex}" />

    private int _ListSelectedIndex;
    public int ListSelectedIndex {
        get { return _ListSelectedIndex;}
        set
        {
            _ListSelectedIndex = value;
            OnPropertyChanged("ListSelectedIndex"); // if INotifyPropertyChanged implemented
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

button has a Command binding into ViewModel (it runs some Save method in ViewModel).
Command button onclick event is not working its not invoking Banking bean Method. There
$('.button').click(function() { $('#small-form').animate({ width: ['toggle', 'swing'], height: ['toggle', 'swing'], opacity: 'toggle' }, 5000, 'linear');
I have a button that I would like to disable when the form submits
I create a new Button object but did not specify the command option upon
I have a Button ... <Button Click=Button_Click /> I'd like to bind a CanClick
Button bn = new Button(); bn.Location = new System.Drawing.Point(560, 350); bn.Name = btnDelete; bn.Text
Like Button: (successfully direct uesrs to specific Facebook pages) Example: [http://lifelearning.x10.mx/FB-test2.html][1] <html xmlns=http://www.w3.org/1999/xhtml xmlns:fb=http://www.facebook.com/2008/fbml>
The button name is not being passed to my action method. Here is my
A button has a title Buy Now, its action talks to App store 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.