combine competitionlist with combobox

This commit is contained in:
Natlinux
2022-11-07 20:59:15 +01:00
parent 149e6caa9a
commit cc6636528c
7 changed files with 132 additions and 16 deletions

View File

@@ -4,6 +4,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Apollon.WPF"
xmlns:components="clr-namespace:Apollon.WPF.Views.Components"
xmlns:views="clr-namespace:Apollon.WPF.Views"
xmlns:vms="clr-namespace:Apollon.WPF.ViewModels"
xmlns:custom="clr-namespace:ModalControl;assembly=ModalControl"
@@ -30,6 +31,9 @@
<DataTemplate DataType="{x:Type vms:OverviewViewModel}">
<views:OverviewView Content="{Binding CurrentViewModel}" DataContext="{Binding OverviewViewModel}"/>
</DataTemplate>
<DataTemplate DataType="{x:Type vms:AddEditDetailsViewModel}">
<components:AddEditDetails/>
</DataTemplate>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>

View File

@@ -1,4 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Apollon.Domain.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -166,19 +167,38 @@ namespace Apollon.WPF.ViewModels
public ICommand SubmitCommand { get; }
public ICommand CancelCommand { get; }
public ObservableCollection<string> CompetitionList { get; set; }
public ObservableCollection<Competition> CompetitionList { get; set; }
public AddEditDetailsViewModel(ICommand submitCommand, ICommand cancelCommand)
{
SubmitCommand = submitCommand;
CancelCommand = cancelCommand;
CompetitionList = new ObservableCollection<string>
CompetitionList = new ObservableCollection<Competition>
{
"Halle", "im Freien", "Feld", "3D"
};
new Competition
{
CompetitionName = "Halle",
CompetitionImage = "targetHall.png"
},
new Competition
{
CompetitionName = "im Freien",
CompetitionImage ="targetOutdoor.png"
},
new Competition
{
CompetitionName = "Feld",
CompetitionImage = "targetField.png"
},
Competition = CompetitionList[1];
new Competition
{
CompetitionName = "3D",
CompetitionImage = "3d.png"
}
};
}
}

View File

@@ -70,8 +70,7 @@
VerticalContentAlignment="Center"
Background="LightGray"/>
<ComboBox Grid.Row="2"
x:Name="ComboBox"
<ComboBox Grid.Row="2"
Text="{Binding Competition}"
IsReadOnly="False"
IsEditable="True"
@@ -81,14 +80,10 @@
FontSize="16"
VerticalContentAlignment="Center"
HorizontalAlignment="Left"
ItemsSource="{Binding CompetitionList}">
<!--<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Source=}"/>
</DataTemplate>
</ComboBox.ItemTemplate>-->
ItemsSource="{Binding CompetitionList}"
DisplayMemberPath="CompetitionName">
</ComboBox>
<Image x:Name="CompetitionImage"
Grid.Row="2"
Grid.Column="1"