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

Server side JSON minification .net Core
using try catch block in webservice and sending the result in angularjs controller
How to detect if the files are copying to USB device or USB device is busy
c# wpf getting input from textbox in dynamically generated DataTemplate objects
Loading spreadsheet template file doesn't retain form button
Openssl command with certificate in different path from OpenSSL directory
Windows Service with Autofac Holds onto References
LINQ expression with multiple methods
True being returned as false
Custom Console.WriteLine w/ Stream buffer
Any faster way to set console colors?
Custom Conversion throws exception Automapper 5.2.0
htmlagilitypack getting meta tag with content attributes
Quickest way to detect missing values in json or list of objects
Why is this parameter empty?
Retrieving Dropdown List Value in MVC [duplicate]

Categories

HOME
classification
gcc
ssms
optimization
compression
formatting
webvr
autocad
meson-build
zabbix
rethinkdb
minimax
mongoimport
resharper
browsermob
internet-explorer-7
scotty
sonarlint
url-parameters
javaagents
core-animation
pydub
smart-device
edirectory
mobile-development
schedule
lines
opencsv
wordpress-rest-api
voyager
webmock
geocomplete
cache-control
iterm2
observer-pattern
head
servicebus
reqif
mef
infovis
g77
nao-robot
typewriter
cc
reloaddata
apache-commons-cli
sqlproj
lattice
strtol
particle-system
bytearray
supervised-learning
3d-rendering
razorengine
python-rq
custom-build-step
datamodel
apache2-module
instabug
matlab-engine
overlapping
gtkwave
controlpanel
serial-communication
transport
persian
first-order-logic
data-representation
valdr-bean-validation
douglas-peucker
xmla
esri-arc-engine
system.io.packaging
breeze-sharp
vundle
pytz
livescript
serializer
behance-api
django-tests
dateadd
rda
lettuce
xps
new-operator
power-management
nomachine
dd4t
openafs
aspmenu-control
socketasynceventargs
wxperl
fileoutputstream
discussion-board
mismatch
functional-specifications
zipstream
carbon-emacs
time-management
html-help-workshop
stackless

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