Comments (3)
Got it from Caliburn.Micro like this:
Main ViewModel
public class MainViewModel : Conductor<IScreen>.Collection.OneActive
{
public MainViewModel(IEnumerable<TabItem> tabs)
{
DisplayName = "Name";
Items.AddRange(tabs);
}
}
Prepared a marker interface for all child items
public interface TabItem: IScreen
{
}
Registering and binding interface to viewmodels
protected override void ConfigureIoC(IStyletIoCBuilder builder)
{
builder.Bind(typeof(TabItem)).ToAllImplementations();
}
from stylet.
Hi,
Sorry for the delay - Christmas and New Year happened.
Is your question resolved?
Note that, in your second post, the order of tabs
isn't guaranteed: it may changed based on random stuff.
from stylet.
You're absolutely right, the tabs will be placed in the same order the classes are injected, but I have custom sorting for that. If someone wants to have a control over the ordering, you can order them in 'MainViewModel' constructor by either passing a custom 'IComparer' or adding some property you can OrderBy or select to the ITabItem interface. Also you can use IList methods to sort items. The default selected item will be the first one in the Items list (the same as in caliburn.micro tho). Question is resolved ofc.
from stylet.
Related Issues (20)
- Unable to use Style in xaml
- Built-in message box button text clips HOT 1
- Documentation correction
- EventAggregator shouldn't call handlers from within a lock
- when TabControl and Frame are used,viewmodel do not carry out HOT 1
- OnInitialActivate does not get called in "Child" Screen
- Using MicrosoftDependencyInjectionBootstrapper runtime errors
- How to ignore StyletIoCFindConstructorException
- About button binding HOT 1
- NRE in design mode with MahApps HamburgerMenu control
- Cannot open a new discussion! HOT 3
- ClassLibrary Start Stylet It is necessary!
- ShowMessageBox MessageBoxButtons.YesNo disabling the Esc key and Window "X" close functionality
- BindableCollection races against any call which adds/removes elements before it
- System.Text.Json Json serialization / deserialization fails HOT 5
- Binding an abstract type which has an abstract inheritor ToAllImplementations causes StyletIoCRegistrationException
- `ShowMessageBox` freeze primary window when show a message box on secondary windows HOT 2
- Conductor.OnActivate() shoudl not be required to call base.OnActivate() HOT 4
- referencing grpc.net.client in the project, error CS0234 is reported. HOT 1
- I have a class ScreenEx that inherits from Screen, rewriting OnActivate in a new ViewModel that is unresponsive HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stylet.