From 149e6caa9acfd629b6b4385bc1142cf289cd0c28 Mon Sep 17 00:00:00 2001 From: Natlinux <97396587+Natlinux81@users.noreply.github.com> Date: Mon, 7 Nov 2022 16:09:05 +0100 Subject: [PATCH] update combobox --- .../ViewModels/AddEditDetailsViewModel.cs | 35 ++++++++++++------ .../Views/Components/AddEditDetails.xaml | 37 +++++++++++-------- .../Views/Components/AddEditDetails.xaml.cs | 36 +----------------- 3 files changed, 47 insertions(+), 61 deletions(-) diff --git a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs index f551018..47b4c6e 100644 --- a/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs +++ b/Apollon.WPF/ViewModels/AddEditDetailsViewModel.cs @@ -1,5 +1,7 @@ -using System; +using Microsoft.EntityFrameworkCore; +using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -10,6 +12,7 @@ namespace Apollon.WPF.ViewModels { public class AddEditDetailsViewModel : ViewModelBase { + private string _organisation; public string Organisation { @@ -37,10 +40,10 @@ namespace Apollon.WPF.ViewModels OnPropertyChanged(nameof(TournamentName)); OnPropertyChanged(nameof(CanSubmit)); } - } + } - private string _competition; - public string Competition + private string _competition; + public string Competition { get { @@ -49,11 +52,12 @@ namespace Apollon.WPF.ViewModels set { _competition = value; - OnPropertyChanged(nameof(Competition)); + OnPropertyChanged(nameof(Competition)); + } - } + } - private string _competitionImage; + private string _competitionImage; public string CompetitionImage { get @@ -162,11 +166,20 @@ namespace Apollon.WPF.ViewModels public ICommand SubmitCommand { get; } public ICommand CancelCommand { get; } + public ObservableCollection CompetitionList { get; set; } + public AddEditDetailsViewModel(ICommand submitCommand, ICommand cancelCommand) - { - SubmitCommand = submitCommand; - CancelCommand = cancelCommand; + { + SubmitCommand = submitCommand; + CancelCommand = cancelCommand; + + CompetitionList = new ObservableCollection + { + "Halle", "im Freien", "Feld", "3D" + }; + + Competition = CompetitionList[1]; } - } + } } diff --git a/Apollon.WPF/Views/Components/AddEditDetails.xaml b/Apollon.WPF/Views/Components/AddEditDetails.xaml index 7f4e776..8fe76fe 100644 --- a/Apollon.WPF/Views/Components/AddEditDetails.xaml +++ b/Apollon.WPF/Views/Components/AddEditDetails.xaml @@ -1,13 +1,14 @@ - - + @@ -27,27 +28,27 @@ - + - + - + - + - + - + @@ -59,7 +60,7 @@ Height="30" Background="LightGray" VerticalContentAlignment="Center"/> - + + ItemsSource="{Binding CompetitionList}"> + - - + - + + Visibility="{Binding HasErrorMessage, Converter={StaticResource BooleanToVisibilityConverter}}"/> - +