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

The Archive Base Latest Questions

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

I have one ViewModel and two Views. How can I navigate to View2 from

  • 0

I have one ViewModel and two Views. How can I navigate to View2 from ViewModel. I read somewhere that we need to use PRISM, for opening multiple Views from ViewModel in Silverlight. Is there any alternative for PRISM?

  • 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:48:56+00:00Added an answer on May 30, 2026 at 3:48 am

    Ideally you do not want to use view logic in your viewmodel. Your viewmodel should not know anything about the view. It would be a better idea for your viewmodel to set a property letting the view know it’s time to navigate.
    Here’s an example:

    ViewModel:

    using System.ComponentModel;
    
    namespace ViewModels
    {
        public class MyViewModel : INotifyPropertyChanged
        {
            public event PropertyChangedEventHandler PropertyChanged;
            private void NotifyPropertyChanged(string propertyName)
            {
                if (PropertyChanged == null) return;
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
    
            private bool _DoneDoingStuff;
            public bool DoneDoingStuff
            {
                get
                {
                    return _DoneDoingStuff;
                }
                set
                {
                    if (_DoneDoingStuff != value)
                    {
                        _DoneDoingStuff = value;
                        NotifyPropertyChanged("DoneDoingStuff");
                    }
                }
            }
        }
    }
    

    View:

    <navigation:Page
        x:Class="Views.MyView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
        xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
        xmlns:vm="clr-namespace:ViewModels">
        <navigation:Page.Resources>
            <vm:MyViewModel
                x:Key="MyViewModelInstance" />
        </navigation:Page.Resources>
        <Grid
            x:Name="LayoutRoot"
            DataContext="{Binding Source={StaticResource MyViewModelInstance}}">
            <i:Interaction.Triggers>
                <ei:DataTrigger
                    Binding="{Binding DoneDoingStuff}"
                    Value="True">
                    <ei:HyperlinkAction
                        NavigateUri="AnotherPage.xaml" />
                </ei:DataTrigger>
            </i:Interaction.Triggers>
        </Grid>
    </navigation:Page>
    
    • Use a DataTrigger with Binding property set to the DoneDoingStuff property from your viewmodel, and the Value property set to “True”. The DataTrigger will trigger when DoneDoingStuff from your viewmodel is set to true.

    • Now you need a trigger action to navigate. Use HyperlinkAction with the NavigateUri property set to the page you’re navigating to.

    • Be sure to have System.Windows.Interactivity, System.Windows.Controls.Navigation, and Microsoft.Expression.Interactions assemblies in your references.

    At first, this might seem to be too much, but your view logic is now where it needs to be.

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

Sidebar

Related Questions

I have two ViewModels that present the same Model to different Views. One presents
I have one field that I need to sum lets say named items However
I have one text input and one button (see below). How can I use
I have senario in which one view and view has binding with multiple ViewModel.
I have one thread that writes results into a Queue. In another thread (GUI),
I have one hibernate sequence, that generates all sequence-numbers in my app. When I
I have two views of some data: a list view (a ListBox now, but
We have two WebApplication in one MVC solution, one for Desktop and the other
I have two HeaderedContentControl s like those below that each have their content property
I have one property on my view model that is used in a select

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.