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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:24:22+00:00 2026-05-26T05:24:22+00:00

In my Silverlight app I have a view containing a tab control and a

  • 0

In my Silverlight app I have a view containing a tab control and a view model of this view.
When the selected tab is changed, I need to refresh its data. In order to do that in the view model I’m using a command triggered by EventTrigger in the view and passing the appropriate event args to it (as described here http://weblogs.asp.net/alexeyzakharov/archive/2010/03/24/silverlight-commands-hacks-passing-eventargs-as-commandparameter-to-delegatecommand-triggered-by-eventtrigger.aspx).
Each tab item has its own view model and, therefore, to distinguish which view model I have to use to refresh the data, I’m watching the header in the tab item which I can get from the event args, e.g:

_tabSelectionChangedCommand = new DelegateCommand<SelectionChangedEventArgs>(TabSelectionChanged);
public ICommand TabSelectionChangedCommand
{
   get { return _tabSelectionChangedCommand; }
}

private void TabSelectionChanged(SelectionChangedEventArgs e)
{    
    var tabItem = (TabItem)e.e.AddedItems[0];
    if (tabItem.Header == "Header1" )
    {                    
         TabItem1ViewModel.Refresh();
    }
     .....
 }

So, my question is :
Is good that I’m using in the view model the types related to the UI(TabItem, SelectionChangedEventArgs) and are there better ways to do what I’ve described above?

  • 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-26T05:24:22+00:00Added an answer on May 26, 2026 at 5:24 am

    Maybe you can bind the SelectedIndex of the TabControl to a property defined in your viewmodel and attach an InvokeActionCommand to the TabControl and subscrible to its SelectionChanged event.

    Then when the command gets called, check which index it is then load the data accordingly?

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

Sidebar

Related Questions

I have a Silverlight app that uses actions to get data from the model
I Have a Silverlight WPF app that shows tabs of data in this case
I have a Silverlight app that utilizes the Bing Maps control. Data loads when
I'm writing a Silverlight app using the MVVM pattern. I have a main view
I have a Silverlight app with a DataGrid containing some custom columns and all
I have 2 touch enabled Canvas' in a Silverlight App. What I need to
I have a WCF web-service and a Silverlight app displaying data from that service.
In my silverlight app i have a view with a listbox: <ListBox Canvas.Left=12 Canvas.Top=72
I have a silverlight app and winform app. My requirement changed to Display the
I have a Silverlight Windows Phone 7 app that pulls data from a public

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.