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.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,6 +12,7 @@ namespace Apollon.WPF.ViewModels
|
|||||||
{
|
{
|
||||||
public class AddEditDetailsViewModel : ViewModelBase
|
public class AddEditDetailsViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
|
|
||||||
private string _organisation;
|
private string _organisation;
|
||||||
public string Organisation
|
public string Organisation
|
||||||
{
|
{
|
||||||
@@ -50,6 +53,7 @@ namespace Apollon.WPF.ViewModels
|
|||||||
{
|
{
|
||||||
_competition = value;
|
_competition = value;
|
||||||
OnPropertyChanged(nameof(Competition));
|
OnPropertyChanged(nameof(Competition));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,10 +166,19 @@ 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 AddEditDetailsViewModel(ICommand submitCommand, ICommand cancelCommand)
|
public AddEditDetailsViewModel(ICommand submitCommand, ICommand cancelCommand)
|
||||||
{
|
{
|
||||||
SubmitCommand = submitCommand;
|
SubmitCommand = submitCommand;
|
||||||
CancelCommand = cancelCommand;
|
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="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:Apollon.WPF.Views.Components"
|
xmlns:local="clr-namespace:Apollon.WPF.Views.Components"
|
||||||
xmlns:custom="clr-namespace:LoadingSpinnerControl;assembly=LoadingSpinnerControl"
|
xmlns:custom="clr-namespace:LoadingSpinnerControl;assembly=LoadingSpinnerControl"
|
||||||
|
xmlns:ViewModels="clr-namespace:Apollon.WPF.ViewModels" x:Class="Apollon.WPF.Views.Components.AddEditDetails"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||||
@@ -80,11 +81,15 @@
|
|||||||
FontSize="16"
|
FontSize="16"
|
||||||
VerticalContentAlignment="Center"
|
VerticalContentAlignment="Center"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Loaded="ComboBox_Loaded"
|
ItemsSource="{Binding CompetitionList}">
|
||||||
SelectionChanged="ComboBox_SelectionChanged">
|
<!--<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Source=}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>-->
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<Image Name="CompetitionImage"
|
<Image x:Name="CompetitionImage"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
|
|||||||
@@ -26,38 +26,6 @@ namespace Apollon.WPF.Views.Components
|
|||||||
InitializeComponent();
|
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