combine competitionlist with combobox
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
14
Apollon.Domain/Models/Competition.cs
Normal file
14
Apollon.Domain/Models/Competition.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Apollon.Domain.Models
|
||||||
|
{
|
||||||
|
public class Competition
|
||||||
|
{
|
||||||
|
public string CompetitionName{ get; set; }
|
||||||
|
public string CompetitionImage{ get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
64
Apollon.EntityFramework/Migrations/20221107194347_competition.Designer.cs
generated
Normal file
64
Apollon.EntityFramework/Migrations/20221107194347_competition.Designer.cs
generated
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using Apollon.EntityFramework;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Apollon.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(TournamentsDbContext))]
|
||||||
|
[Migration("20221107194347_competition")]
|
||||||
|
partial class competition
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "6.0.8")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
|
||||||
|
|
||||||
|
modelBuilder.Entity("Apollon.EntityFramework.DTOs.TournamentDto", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<string>("Competition")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("CompetitionImage")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<DateTime>("EndDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("Location")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<string>("Organisation")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Rounds")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("StartDate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<string>("TournamentName")
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Tournaments");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Apollon.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
public partial class competition : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Apollon.WPF"
|
xmlns:local="clr-namespace:Apollon.WPF"
|
||||||
|
xmlns:components="clr-namespace:Apollon.WPF.Views.Components"
|
||||||
xmlns:views="clr-namespace:Apollon.WPF.Views"
|
xmlns:views="clr-namespace:Apollon.WPF.Views"
|
||||||
xmlns:vms="clr-namespace:Apollon.WPF.ViewModels"
|
xmlns:vms="clr-namespace:Apollon.WPF.ViewModels"
|
||||||
xmlns:custom="clr-namespace:ModalControl;assembly=ModalControl"
|
xmlns:custom="clr-namespace:ModalControl;assembly=ModalControl"
|
||||||
@@ -30,6 +31,9 @@
|
|||||||
<DataTemplate DataType="{x:Type vms:OverviewViewModel}">
|
<DataTemplate DataType="{x:Type vms:OverviewViewModel}">
|
||||||
<views:OverviewView Content="{Binding CurrentViewModel}" DataContext="{Binding OverviewViewModel}"/>
|
<views:OverviewView Content="{Binding CurrentViewModel}" DataContext="{Binding OverviewViewModel}"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vms:AddEditDetailsViewModel}">
|
||||||
|
<components:AddEditDetails/>
|
||||||
|
</DataTemplate>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Apollon.Domain.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
@@ -166,19 +167,38 @@ namespace Apollon.WPF.ViewModels
|
|||||||
public ICommand SubmitCommand { get; }
|
public ICommand SubmitCommand { get; }
|
||||||
public ICommand CancelCommand { get; }
|
public ICommand CancelCommand { get; }
|
||||||
|
|
||||||
public ObservableCollection<string> CompetitionList { get; set; }
|
public ObservableCollection<Competition> CompetitionList { get; set; }
|
||||||
|
|
||||||
public AddEditDetailsViewModel(ICommand submitCommand, ICommand cancelCommand)
|
public AddEditDetailsViewModel(ICommand submitCommand, ICommand cancelCommand)
|
||||||
{
|
{
|
||||||
SubmitCommand = submitCommand;
|
SubmitCommand = submitCommand;
|
||||||
CancelCommand = cancelCommand;
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,6 @@
|
|||||||
Background="LightGray"/>
|
Background="LightGray"/>
|
||||||
|
|
||||||
<ComboBox Grid.Row="2"
|
<ComboBox Grid.Row="2"
|
||||||
x:Name="ComboBox"
|
|
||||||
Text="{Binding Competition}"
|
Text="{Binding Competition}"
|
||||||
IsReadOnly="False"
|
IsReadOnly="False"
|
||||||
IsEditable="True"
|
IsEditable="True"
|
||||||
@@ -81,12 +80,8 @@
|
|||||||
FontSize="16"
|
FontSize="16"
|
||||||
VerticalContentAlignment="Center"
|
VerticalContentAlignment="Center"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
ItemsSource="{Binding CompetitionList}">
|
ItemsSource="{Binding CompetitionList}"
|
||||||
<!--<ComboBox.ItemTemplate>
|
DisplayMemberPath="CompetitionName">
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Text="{Binding Source=}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</ComboBox.ItemTemplate>-->
|
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<Image x:Name="CompetitionImage"
|
<Image x:Name="CompetitionImage"
|
||||||
|
|||||||
Reference in New Issue
Block a user