c#


WPF Prism initializing tabs with ICollection using Navigation


I have a tab view model, it works by when you create a new tab, it generates a new instance of Class B.
However, there is the possibility that the program can load a file which, using JSON, gets an instance of Class A which has a collection of Class B.
How can I instantiate the tabs with the existing collection of Class B Object? Preferably still using Navigation instead of View Injection/Discovery.
Here is my code for adding a new tab
public void AddTabCommandAction()
{
_regionManager.RequestNavigate(RegionNames.TabRegion, "ClassBView");
}
And my class B viewmodel.
public ClassBViewModel(ClassB b){
_b = b;
}
I am using UnityContainer to resolve types of ClassB.
Probably not the best solution but I solved the issue by using the Navigation journal.
The on navigated to method in the tabs view model
foreach (var item in list)
{
AddTabCommandAction(item);
}
Passing in the item as a naviagaion parameter
OnNavigatedTo method of the tab view model
var classB= navigationContext.Parameters["ClassB"];
if (classB!= null)
_classB= (ClassB) classB;

Related Links

tcp having trouble connecting c#
Are there commonly used delegates available in the standard class libraries?
How to set website theme to all webpages using a drop down list?
How to set selectedcolor of ColorCanvas by using Argb in code behind
How to set a transition property using Transitionals library
How to limit textbox maxlength by byte in winrt?
Entity Framework 6 database migrations for isolated multi-tenant setup
File upload / did I make a mistake choosing vb.net instead of php?
Find data in database
Calling sharepoint from web service
Baidu web search engine API
Searching for records on one exact day
Must declare the scalar variable “#ID” for insert parameter
How to get an Image from facebook and use ImageResizer MVC4 & C#
Launch another application [duplicate]
WriteAllLines arguments give an overload error

Categories

HOME
airflow
model-view-controller
teradata
primefaces
intellij-idea
x86-64
jquery-plugins
query-string
checkpoint
android-webview
gcloud
openbsd
angular-universal
aspectj
unreal-engine4
github-flavored-markdown
appsettings
owncloud
taxonomy
template10
web-parts
jquery-easyui
minimagick
xna
serenity-js
android-navigation-drawer
dev-c++
fibonacci
bootstrap-accordion
ds-5
folder
angularjs-resource
intersection
sampling
file-conversion
django-cors-headers
android-doze-and-standby
openxava
monaca
ear
extjs3
openpgp.js
zedgraph
ownership
indoor-positioning-system
git-cherry-pick
dcast
instabug
dnvm
syncano
dpkt
polarion
genero
service-broker
numerical-recipes
douglas-peucker
pysvn
clearcanvas
nsnotificationcenter
dotcmis
atg-dynamo
rails-migrations
iwork
connections
boofcv
mdp
php-amqplib
ardor3d
ironworker
xrandr
google-checkout
uikit-dynamics
exi
openafs
datasheet
openwrap
method-call
llblgen
pitch-shifting
code-golf
software-update

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App