Hallo,
heute komme ich mal wieder mit einem Interessanten Problem.
Ich will ein kleines Programm zum Verwalten von Musikstücken schreiben.
Dabei können Musikstücke (
Hier mal die ViewModels von
Spoiler anzeigen
Spoiler anzeigen
Jetzt will ich eine "interessante" UI gestalten.
Erstmal habe ich zwei Skizzen angehangen un es zu verdeutlichen:


Ich möchte im Entefekt an der linken Seite eine ListView haben, in der alle
Je nach dem ob die Combobox aktiviert ist, soll auf der rechten Seite ein neues ListView eingeblendet werden, in dem jeweils alle
Als Bonus oben drauf soll man die
Nun habe ich leider keinen Ansatz wie ich das ViewModel für dieses View gestalten soll (also eine ObservableCollection(Of OrganisationListViewModel) und die Songs müssen halt irgendwie rein).
Und ich denke man kann das mit den ganzen ListViews, die eingeblendet werden sollen irgendwie mit UserControls (und DataTemplates) lösen...
Vielen Dank für eure Mühe schon mal bis hier her zu lesen
Viele Grüße
Florian
heute komme ich mal wieder mit einem Interessanten Problem.
Ich will ein kleines Programm zum Verwalten von Musikstücken schreiben.
Dabei können Musikstücke (
Song
) einer Liste (OrganisationList
) zugeordnet werden.Hier mal die ViewModels von
Song
und OrganisationList
:
C#-Quellcode
- public class SongViewModel : ViewModelBase
- {
- public Song SongModel { get; set; }
- public SongViewModel(Song songModel, (List<GenreViewModel> Genres, List<OrganisationListViewModel> OrganisationLists ) aviableData)
- {
- SongModel = songModel;
- AviableGenres = aviableData.Genres;
- AviableOrganisationLists = aviableData.OrganisationLists;
- Name = SongModel.Name;
- Interpret = SongModel.Interpret;
- Album = SongModel.Album;
- ID = SongModel.ID;
- Comment = SongModel.Comment;
- CreatedBy = SongModel.CreatedBy;
- CreationTimeStamp = SongModel.CreationTimeStamp;
- LastModifiedBy = SongModel.LastModifiedBy;
- LastModifiedTimeStamp = SongModel.LastModifiedTimeStamp;
- Genre = AviableGenres.Where(x => x.ID == SongModel.GenreID).FirstOrDefault();
- OrganisationList = AviableOrganisationLists.Where(x => x.ID == SongModel.OrganisationListID).FirstOrDefault();
- }
- public string Name
- {
- get { return SongModel.Name; }
- set { SongModel.Name = value; RaisePropertyChanged(); }
- }
- public string Interpret
- {
- get { return SongModel.Interpret; }
- set { SongModel.Interpret = value; RaisePropertyChanged(); }
- }
- public string Album
- {
- get { return SongModel.Album; }
- set { SongModel.Album = value; RaisePropertyChanged(); }
- }
- #region ModelBase
- //ModelBase
- public Guid ID
- {
- get { return SongModel.ID; }
- set { SongModel.ID = value; RaisePropertyChanged(); }
- }
- public string Comment
- {
- get { return SongModel.Comment; }
- set { SongModel.Comment = value; RaisePropertyChanged(); }
- }
- public string CreatedBy
- {
- get { return SongModel.CreatedBy; }
- set { SongModel.CreatedBy = value; RaisePropertyChanged(); }
- }
- public DateTime CreationTimeStamp
- {
- get { return SongModel.CreationTimeStamp; }
- set { SongModel.CreationTimeStamp = value; RaisePropertyChanged(); }
- }
- public string LastModifiedBy
- {
- get { return SongModel.LastModifiedBy; }
- set { SongModel.LastModifiedBy = value; RaisePropertyChanged(); }
- }
- public DateTime LastModifiedTimeStamp
- {
- get { return SongModel.LastModifiedTimeStamp; }
- set { SongModel.LastModifiedTimeStamp = value; RaisePropertyChanged(); }
- }
- //End ModelBase
- #endregion
- public List<GenreViewModel> AviableGenres { get; }
- public List<OrganisationListViewModel> AviableOrganisationLists { get; }
- private GenreViewModel _Genre;
- public GenreViewModel Genre
- {
- get { return _Genre; }
- set { _Genre = value; SongModel.GenreID = value.ID; RaisePropertyChanged(); }
- }
- private OrganisationListViewModel _OrganisationList;
- public OrganisationListViewModel OrganisationList
- {
- get { return _OrganisationList; }
- set { _OrganisationList = value; SongModel.OrganisationListID = value.ID; RaisePropertyChanged(); }
- }
- }
C#-Quellcode
- public class OrganisationListViewModel : ViewModelBase
- {
- public OrganisationList OrganisationListModel { get; set; }
- public OrganisationListViewModel(OrganisationList organisationListModel,List<StatusViewModel> aviableData)
- {
- OrganisationListModel = organisationListModel;
- AviableStatuses = aviableData;
- Name = OrganisationListModel.Name;
- ID = OrganisationListModel.ID;
- Comment = OrganisationListModel.Comment;
- CreatedBy = OrganisationListModel.CreatedBy;
- CreationTimeStamp = OrganisationListModel.CreationTimeStamp;
- LastModifiedBy = OrganisationListModel.LastModifiedBy;
- LastModifiedTimeStamp = OrganisationListModel.LastModifiedTimeStamp;
- Status = AviableStatuses.Where(x => x.ID == OrganisationListModel.StatusID).FirstOrDefault();
- }
- public string Name
- {
- get { return OrganisationListModel.Name; }
- set { OrganisationListModel.Name = value; RaisePropertyChanged(); }
- }
- public string NameAndStatus
- {
- get { return Name + " - " + Status.Name; }
- }
- #region ModelBase
- //ModelBase
- public Guid ID
- {
- get { return OrganisationListModel.ID; }
- set { OrganisationListModel.ID = value; RaisePropertyChanged(); }
- }
- public string Comment
- {
- get { return OrganisationListModel.Comment; }
- set { OrganisationListModel.Comment = value; RaisePropertyChanged(); }
- }
- public string CreatedBy
- {
- get { return OrganisationListModel.CreatedBy; }
- set { OrganisationListModel.CreatedBy = value; RaisePropertyChanged(); }
- }
- public DateTime CreationTimeStamp
- {
- get { return OrganisationListModel.CreationTimeStamp; }
- set { OrganisationListModel.CreationTimeStamp = value; RaisePropertyChanged(); }
- }
- public string LastModifiedBy
- {
- get { return OrganisationListModel.LastModifiedBy; }
- set { OrganisationListModel.LastModifiedBy = value; RaisePropertyChanged(); }
- }
- public DateTime LastModifiedTimeStamp
- {
- get { return OrganisationListModel.LastModifiedTimeStamp; }
- set { OrganisationListModel.LastModifiedTimeStamp = value; RaisePropertyChanged(); }
- }
- //End ModelBase
- #endregion
- public List<StatusViewModel> AviableStatuses { get; }
- private StatusViewModel _Status;
- public StatusViewModel Status
- {
- get { return _Status; }
- set { _Status = value; OrganisationListModel.StatusID = value.ID; RaisePropertyChanged(); }
- }
- }
Jetzt will ich eine "interessante" UI gestalten.
Erstmal habe ich zwei Skizzen angehangen un es zu verdeutlichen:
Ich möchte im Entefekt an der linken Seite eine ListView haben, in der alle
OrganisationLists
zu sehen sind. Auserdem eine Checkbox um auszuwählen, ob sie zu "sehen" sind.Je nach dem ob die Combobox aktiviert ist, soll auf der rechten Seite ein neues ListView eingeblendet werden, in dem jeweils alle
Songs
zu sehen sind, die der OrganisationList
zugeordnet sind.Als Bonus oben drauf soll man die
Songs
dann noch zwischen den ListViews "hin und her" ziehen können, um sie so einer neuen OrganisationList
zuzuordnen.Nun habe ich leider keinen Ansatz wie ich das ViewModel für dieses View gestalten soll (also eine ObservableCollection(Of OrganisationListViewModel) und die Songs müssen halt irgendwie rein).
Und ich denke man kann das mit den ganzen ListViews, die eingeblendet werden sollen irgendwie mit UserControls (und DataTemplates) lösen...
Vielen Dank für eure Mühe schon mal bis hier her zu lesen

Viele Grüße
Florian
----
WebApps mit C#: Blazor
WebApps mit C#: Blazor