update combobox
This commit is contained in:
@@ -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
|
||||
{
|
||||
@@ -39,7 +42,7 @@ namespace Apollon.WPF.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private string _competition;
|
||||
private string _competition;
|
||||
public string Competition
|
||||
{
|
||||
get
|
||||
@@ -50,10 +53,11 @@ namespace Apollon.WPF.ViewModels
|
||||
{
|
||||
_competition = value;
|
||||
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<string> CompetitionList { get; set; }
|
||||
|
||||
public AddEditDetailsViewModel(ICommand submitCommand, ICommand cancelCommand)
|
||||
{
|
||||
SubmitCommand = submitCommand;
|
||||
CancelCommand = cancelCommand;
|
||||
{
|
||||
SubmitCommand = submitCommand;
|
||||
CancelCommand = cancelCommand;
|
||||
|
||||
CompetitionList = new ObservableCollection<string>
|
||||
{
|
||||
"Halle", "im Freien", "Feld", "3D"
|
||||
};
|
||||
|
||||
Competition = CompetitionList[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<UserControl x:Class="Apollon.WPF.Views.Components.AddEditDetails"
|
||||
<UserControl
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Apollon.WPF.Views.Components"
|
||||
xmlns:custom="clr-namespace:LoadingSpinnerControl;assembly=LoadingSpinnerControl"
|
||||
xmlns:ViewModels="clr-namespace:Apollon.WPF.ViewModels" x:Class="Apollon.WPF.Views.Components.AddEditDetails"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||
@@ -80,11 +81,15 @@
|
||||
FontSize="16"
|
||||
VerticalContentAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Loaded="ComboBox_Loaded"
|
||||
SelectionChanged="ComboBox_SelectionChanged">
|
||||
ItemsSource="{Binding CompetitionList}">
|
||||
<!--<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Source=}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>-->
|
||||
</ComboBox>
|
||||
|
||||
<Image Name="CompetitionImage"
|
||||
<Image x:Name="CompetitionImage"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Grid.RowSpan="2"
|
||||
@@ -135,7 +140,7 @@
|
||||
TextAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="Red"
|
||||
Visibility="{Binding HasErrorMessage, Converter= {StaticResource BooleanToVisibilityConverter}}"/>
|
||||
Visibility="{Binding HasErrorMessage, Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
|
||||
<Grid Grid.Row="7"
|
||||
Grid.ColumnSpan="2"
|
||||
|
||||
@@ -26,38 +26,6 @@ namespace Apollon.WPF.Views.Components
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
private void ComboBox_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
List<string> competitions = new List<string>()
|
||||
{
|
||||
"Halle", "im Freien", "Feld", "3D"
|
||||
};
|
||||
ComboBox.ItemsSource = competitions;
|
||||
}
|
||||
|
||||
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
|
||||
if (ComboBox.SelectedIndex == 0)
|
||||
{
|
||||
CompetitionImage.Source = new BitmapImage(new Uri(@"D:\Projekte\Apollon\Apollon\Apollon.WPF\Images\TargetHall.png"));
|
||||
}
|
||||
if (ComboBox.SelectedIndex == 1)
|
||||
{
|
||||
CompetitionImage.Source = new BitmapImage(new Uri("D:\\Projekte\\Apollon\\Apollon\\Apollon.WPF\\Images\\TargetField.png"));
|
||||
}
|
||||
if (ComboBox.SelectedIndex == 2)
|
||||
{
|
||||
CompetitionImage.Source = new BitmapImage(new Uri("D:\\Projekte\\Apollon\\Apollon\\Apollon.WPF\\Images\\TargetOutdoor.png"));
|
||||
}
|
||||
if (ComboBox.SelectedIndex == 3)
|
||||
{
|
||||
CompetitionImage.Source = new BitmapImage(new Uri("D:\\Projekte\\Apollon\\Apollon\\Apollon.WPF\\Images\\3D.png"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user