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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:48:41+00:00 2026-05-31T23:48:41+00:00

I have been trying to do this for ages and having no joy whatsoever.

  • 0

I have been trying to do this for ages and having no joy whatsoever.

I have a ribbon window of the following hierarchy:

  • MainWindow
    • MainContent (Tab Control)
      • TabContainerViewModel
        • ViewModelBase

View model base has an ObservableCollection of tabs type ViewModelBase. The Tab Control itself is binding fine to these, displaying appropriate view models. I have 2 problems however, I want a “NotepadView” (Of type viewmodelbase) to be replicated numerous times (one view many view models).

At the minute, I have 4 views (NotePadViewModelx where x is 1-4) with corresponding viewmodels, this is because each view had the same text per tab. Now I have individual views per tab.

When I type into tab 1 and switch to tab 2, I lose what I typed in tab one when I click back.

Could somebody help to provide me with a solution to these problems?

  • One NotepadView for multiple instances of the ViewModel
  • Keeping information when tabs change

Many 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-31T23:48:42+00:00Added an answer on May 31, 2026 at 11:48 pm

    I moved the Header and Text properties into ViewModelBase and then when I add a ViewModelBase as a Tab I used a DataTemplate for the ViewModelBase as I was for the NotePadViewModels with just a textbox.

      <DataTemplate DataType="{x:Type ui:ViewModelBase}">
        <TextBox Text="{Binding Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
      </DataTemplate>
    

    As apose to using this:

      <DataTemplate DataType="{x:Type ui:NotepadViewModel}">
          <ui:NotePadView DataContext="{Binding}"/>
      </DataTemplate>
      <DataTemplate DataType="{x:Type ui:NotepadViewModel2}">
          <ui:NotePadView2 DataContext="{Binding}"/>
      </DataTemplate>
      <DataTemplate DataType="{x:Type ui:NotepadViewModel3}">
          <ui:NotePadView3 DataContext="{Binding}"/>
      </DataTemplate>
    

    Thanks to Rachel for a small hint to the problem. Basically on the previous way nothing was actually binding within the datatemplate so it had no reason to keep it as a resource. By adding a default textbox within a datatemplate I can add as many notepads as I want whilst being able to add other views which don’t need a textbox.

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

Sidebar

Related Questions

Just need help as I have been trying sort this out for ages now.
Hi been trying to get this to work for ages, i have a deals
I have been trying this for hours without success. http://replicaisland.googlecode.com/svn/trunk/ I have added the
I've been trying this: NSNumberFormatter *testNumber=[NSNumberFormatter new]; if (![testNumber numberFromString:someNSString]) I have been told
Is there anyone who knows this? I have been trying this for the last
I have been trying to get this one section of my UI to immediatly
I have been trying to figure this out for way to long tonight. I
I have been trying to make this to be a little jQuery plugin that
I have been trying to solve this problem for a while, but couldn't with
I have been trying to get this to work correctly and I think I

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.