lauffähige Grundversion erstellt
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
xmlns:local="clr-namespace:SewerStammGen"
|
||||
>
|
||||
<Application.Resources>
|
||||
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="./Views/styles/my_controls.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
|
||||
45
SewerStammGen/Commands/AsyncCommandBase.cs
Normal file
45
SewerStammGen/Commands/AsyncCommandBase.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace SewerStammGen.Commands
|
||||
{
|
||||
internal abstract class AsyncCommandBase : ICommand
|
||||
{
|
||||
bool _isExecuting = false;
|
||||
public event EventHandler? CanExecuteChanged;
|
||||
|
||||
public bool IsExecuting
|
||||
{
|
||||
get => _isExecuting;
|
||||
set
|
||||
{
|
||||
_isExecuting = value;
|
||||
CanExecuteChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnCanExecuteChanged()
|
||||
{
|
||||
CanExecuteChanged?.Invoke(this, new EventArgs());
|
||||
}
|
||||
|
||||
|
||||
public virtual bool CanExecute(object? parameter)
|
||||
{
|
||||
return !IsExecuting;
|
||||
}
|
||||
|
||||
public async void Execute(object? parameter)
|
||||
{
|
||||
IsExecuting = true;
|
||||
await ExecuteAsync(parameter);
|
||||
IsExecuting = false;
|
||||
}
|
||||
|
||||
public abstract Task ExecuteAsync(object? parameter);
|
||||
}
|
||||
}
|
||||
32
SewerStammGen/Commands/UpdateCurrentViewModelCommand.cs
Normal file
32
SewerStammGen/Commands/UpdateCurrentViewModelCommand.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using SewerStammGen.Enum;
|
||||
using SewerStammGen.Interface;
|
||||
using SewerStammGen.Interface.Navigator;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.Commands
|
||||
{
|
||||
internal class UpdateCurrentViewModelCommand : AsyncCommandBase
|
||||
{
|
||||
private INavigator _navigator;
|
||||
private readonly IViewModelAbstractFactory _viewModelFactory;
|
||||
|
||||
public UpdateCurrentViewModelCommand(INavigator navigator, IViewModelAbstractFactory viewModelFactory)
|
||||
{
|
||||
_navigator = navigator;
|
||||
_viewModelFactory = viewModelFactory;
|
||||
}
|
||||
|
||||
public override async Task ExecuteAsync(object? parameter)
|
||||
{
|
||||
if(parameter is EMainWindowViewType)
|
||||
{
|
||||
EMainWindowViewType viewType = (EMainWindowViewType)parameter;
|
||||
_navigator.CurrentViewModel = _viewModelFactory.CreateViewModel(viewType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,13 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen
|
||||
namespace SewerStammGen.Enum
|
||||
{
|
||||
public enum EMainWindowViewType
|
||||
{
|
||||
Home
|
||||
Home,
|
||||
Projects,
|
||||
Manholes,
|
||||
Sewer
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using SewerStammGen.Interface;
|
||||
using SewerStammGen.ViewModel;
|
||||
using SewerStammGen.ViewModel.Factories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -16,6 +18,14 @@ namespace SewerStammGen.HostBuilders
|
||||
hostBuilder.ConfigureServices(services =>
|
||||
{
|
||||
services.AddTransient<MainWindowViewModel>();
|
||||
services.AddSingleton<CreateViewModel<HomeViewModel>>(services =>
|
||||
{
|
||||
return () => new HomeViewModel();
|
||||
});
|
||||
|
||||
|
||||
|
||||
services.AddSingleton<IViewModelAbstractFactory, MainWindowViewModelFactory>();
|
||||
});
|
||||
|
||||
return hostBuilder;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using SewerStammGen.ViewModel;
|
||||
using SewerStammGen.Enum;
|
||||
using SewerStammGen.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.Interface.Navigator
|
||||
{
|
||||
internal interface IMainWindowNavigator : INavigator
|
||||
public interface IMainWindowNavigator : INavigator
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.Interface.Navigator
|
||||
{
|
||||
internal interface INavigator
|
||||
public interface INavigator
|
||||
{
|
||||
BaseViewModel CurrentViewModel
|
||||
{
|
||||
|
||||
@@ -5,14 +5,15 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:my="clr-namespace:SewerStammGen.Views"
|
||||
xmlns:local="clr-namespace:SewerStammGen"
|
||||
xmlns:controls="clr-namespace:SewerStammGen.Views.Controls"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<my:UCSewerConnector x:Name="SewerConnector" />
|
||||
<controls:UCMainWindowNavigationBar Grid.Column="0" />
|
||||
<ContentControl Grid.Column="1" Content="{Binding CurrentViewModel}" />
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace SewerStammGen
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
SewerConnector.DataContext = new ViewModel.SewerConnectorViewModel();
|
||||
//SewerConnector.DataContext = new ViewModel.SewerConnectorViewModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,15 @@
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Views\Controls\UCMainWindowNavigationBar.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\EditSchacht.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\HomeView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\UCNormXML.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@@ -21,9 +27,18 @@
|
||||
<Page Update="MainWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\Controls\UCMainWindowNavigationBar.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\EditSchacht.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\HomeView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\styles\my_controls.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\UCNormXML.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using SewerStammGen.Enum;
|
||||
using SewerStammGen.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.ViewModel.Factories
|
||||
{
|
||||
public class MainWindowViewModelFactory : IViewModelAbstractFactory
|
||||
{
|
||||
private CreateViewModel<HomeViewModel> _createHomeViewModel;
|
||||
|
||||
public MainWindowViewModelFactory(
|
||||
CreateViewModel<HomeViewModel> createHomeViewModel
|
||||
)
|
||||
{
|
||||
_createHomeViewModel = createHomeViewModel;
|
||||
}
|
||||
|
||||
public BaseViewModel CreateViewModel(EMainWindowViewType viewType)
|
||||
{
|
||||
switch(viewType)
|
||||
{
|
||||
case EMainWindowViewType.Home:
|
||||
return _createHomeViewModel();
|
||||
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
SewerStammGen/ViewModel/HomeViewModel.cs
Normal file
12
SewerStammGen/ViewModel/HomeViewModel.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.ViewModel
|
||||
{
|
||||
public class HomeViewModel : BaseViewModel
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.ViewModel
|
||||
{
|
||||
public interface IViewModel : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public interface IViewModel<TModel> : IViewModel
|
||||
{
|
||||
[Browsable(false)]
|
||||
[Bindable(false)]
|
||||
TModel Model { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,34 @@
|
||||
using SewerStammGen.Interface.Navigator;
|
||||
using SewerStammGen.Commands;
|
||||
using SewerStammGen.Enum;
|
||||
using SewerStammGen.Interface;
|
||||
using SewerStammGen.Interface.Navigator;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace SewerStammGen.ViewModel
|
||||
{
|
||||
internal class MainWindowViewModel : BaseViewModel
|
||||
public class MainWindowViewModel : BaseViewModel
|
||||
{
|
||||
public IMainWindowNavigator Navigator { get; set; }
|
||||
public BaseViewModel CurrentView => Navigator.CurrentViewModel;
|
||||
public BaseViewModel CurrentViewModel => Navigator.CurrentViewModel;
|
||||
|
||||
public MainWindowViewModel(IMainWindowNavigator navigator)
|
||||
public ICommand UpdateCurrentViewModelCommand { get; }
|
||||
|
||||
public MainWindowViewModel(
|
||||
IMainWindowNavigator navigator,
|
||||
IViewModelAbstractFactory viewModelFactory
|
||||
|
||||
)
|
||||
{
|
||||
Navigator = navigator;
|
||||
|
||||
UpdateCurrentViewModelCommand = new UpdateCurrentViewModelCommand(navigator, viewModelFactory);
|
||||
UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Home);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
13
SewerStammGen/ViewModel/ProjectListViewModel.cs
Normal file
13
SewerStammGen/ViewModel/ProjectListViewModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.ViewModel
|
||||
{
|
||||
public class ProjectListViewModel : BaseViewModel
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.ViewModel
|
||||
{
|
||||
class SewerConnectorViewModel : ViewModel
|
||||
class SewerConnectorViewModel : BaseViewModel
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
using Syncfusion.UI.Xaml.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SewerStammGen.ViewModel
|
||||
{
|
||||
[Serializable]
|
||||
public abstract class ViewModel : IViewModel
|
||||
{
|
||||
protected ViewModel()
|
||||
{
|
||||
var initializationTask = new Task(() => Initialize());
|
||||
initializationTask.ContinueWith(result => InitializationCompletedCallback(result));
|
||||
initializationTask.Start();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes this instance.
|
||||
/// </summary>
|
||||
protected virtual void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Callback method for the async initialization.
|
||||
/// </summary>
|
||||
/// <param name="result">The result.</param>
|
||||
private void InitializationCompletedCallback(IAsyncResult result)
|
||||
{
|
||||
var initializationCompleted = InitializationCompleted;
|
||||
if (initializationCompleted != null)
|
||||
{
|
||||
InitializationCompleted(this, new AsyncCompletedEventArgs(null, !result.IsCompleted, result.AsyncState));
|
||||
}
|
||||
InitializationCompleted = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the initialization is completed.
|
||||
/// </summary>
|
||||
public event AsyncCompletedEventHandler InitializationCompleted;
|
||||
|
||||
/// <summary>
|
||||
/// Called when a property has changed.
|
||||
/// </summary>
|
||||
/// <param name="propertyName">Name of the property.</param>
|
||||
/// <remarks></remarks>
|
||||
protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = "")
|
||||
{
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a property value changes.
|
||||
/// </summary>
|
||||
/// <remarks></remarks>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public abstract class ViewModel<TModel> : ViewModel, IViewModel<TModel> where TModel : class
|
||||
{
|
||||
private TModel model;
|
||||
|
||||
/// <summary>
|
||||
/// The Model encapsulated by this ViewModel.
|
||||
/// </summary>
|
||||
/// <remarks>If you change this, all needed PropertyChanged events will be raised automatically.</remarks>
|
||||
[Browsable(false)]
|
||||
[Bindable(false)]
|
||||
public TModel Model
|
||||
{
|
||||
get
|
||||
{
|
||||
return model;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (Model != value)
|
||||
{
|
||||
// get all properties
|
||||
var properties = this.GetType().GetProperties(BindingFlags.Public);
|
||||
// all values before the model has changed
|
||||
var oldValues = properties.Select(p => p.GetValue(this, null));
|
||||
var enumerator = oldValues.GetEnumerator();
|
||||
|
||||
model = value;
|
||||
|
||||
// call OnPropertyChanged for all changed properties
|
||||
foreach (var property in properties)
|
||||
{
|
||||
enumerator.MoveNext();
|
||||
var oldValue = enumerator.Current;
|
||||
var newValue = property.GetValue(this, null);
|
||||
|
||||
if ((oldValue == null && newValue != null)
|
||||
|| (oldValue != null && newValue == null)
|
||||
|| (!oldValue.Equals(newValue)))
|
||||
{
|
||||
OnPropertyChanged(property.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ViewModel"/> class.
|
||||
/// </summary>
|
||||
/// <remarks></remarks>
|
||||
protected ViewModel(TModel model)
|
||||
: base()
|
||||
{
|
||||
this.Model = model;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a hash code for this instance.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
|
||||
/// </returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Model.GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
|
||||
/// </summary>
|
||||
/// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
|
||||
/// <returns>
|
||||
/// <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return false;
|
||||
|
||||
var other = obj as IViewModel<TModel>;
|
||||
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
return Equals(other);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified <see cref="IViewModel<TModel>"/> is equal to this instance.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="IViewModel<TModel>"/> to compare with this instance.</param>
|
||||
/// <returns>
|
||||
/// <c>true</c> if the specified <see cref="IViewModel<TModel>"/> is equal to this instance; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
public bool Equals(IViewModel<TModel> other)
|
||||
{
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
if (Model == null)
|
||||
return Model == other.Model;
|
||||
|
||||
return Model.Equals(other.Model);
|
||||
}
|
||||
}
|
||||
}
|
||||
25
SewerStammGen/Views/Controls/UCMainWindowNavigationBar.xaml
Normal file
25
SewerStammGen/Views/Controls/UCMainWindowNavigationBar.xaml
Normal file
@@ -0,0 +1,25 @@
|
||||
<UserControl x:Class="SewerStammGen.Views.Controls.UCMainWindowNavigationBar"
|
||||
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:nav="clr-namespace:SewerStammGen.Enum"
|
||||
xmlns:viewmodel="clr-namespace:SewerStammGen.ViewModel"
|
||||
xmlns:converter="clr-namespace:SewerStammGen.Views.Converters"
|
||||
xmlns:local="clr-namespace:SewerStammGen.Views.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel}"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<converter:EqualValueToParameterConverter x:Key="EqualValueToParameterConverter" />
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<StackPanel>
|
||||
<RadioButton Content="Home" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:HomeViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Home}" Style="{StaticResource ToggleButtonList}" />
|
||||
<RadioButton Content="Projekte" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Projects}" Style="{StaticResource ToggleButtonList}" />
|
||||
<RadioButton Content="Schächte" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Manholes}" Style="{StaticResource ToggleButtonList}" />
|
||||
<RadioButton Content="Kanäle" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Sewer}" Style="{StaticResource ToggleButtonList}" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SewerStammGen.Views.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für UCMainWindowNavigationBar.xaml
|
||||
/// </summary>
|
||||
public partial class UCMainWindowNavigationBar : UserControl
|
||||
{
|
||||
public UCMainWindowNavigationBar()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace SewerStammGen.Views.Converters
|
||||
{
|
||||
public class EqualValueToParameterConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value.ToString() == parameter.ToString();
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
SewerStammGen/Views/HomeView.xaml
Normal file
12
SewerStammGen/Views/HomeView.xaml
Normal file
@@ -0,0 +1,12 @@
|
||||
<UserControl x:Class="SewerStammGen.Views.HomeView"
|
||||
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:SewerStammGen.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<TextBlock Text="Willkommen" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
SewerStammGen/Views/HomeView.xaml.cs
Normal file
28
SewerStammGen/Views/HomeView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace SewerStammGen.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für HomeView.xaml
|
||||
/// </summary>
|
||||
public partial class HomeView : UserControl
|
||||
{
|
||||
public HomeView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
30
SewerStammGen/Views/styles/my_controls.xaml
Normal file
30
SewerStammGen/Views/styles/my_controls.xaml
Normal file
@@ -0,0 +1,30 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style x:Key="ToggleButtonList" TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="FrameworkElement.OverridesDefaultStyle" Value="True"/>
|
||||
<Setter Property="FrameworkElement.FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Width" Value="170" />
|
||||
<Setter Property="Height" Value="70" />
|
||||
<Setter Property="Margin" Value="2" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Grid>
|
||||
<Rectangle Name="rect" Fill="#FF808080" Stretch="Fill"/>
|
||||
<ContentPresenter VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5" RecognizesAccessKey="True" TextBlock.FontFamily="Seggeo" TextBlock.FontSize="16" TextBlock.Foreground="#FFFFFFFF" TextBlock.FontWeight="Light" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="UIElement.IsMouseOver" Value="True">
|
||||
<Setter TargetName="rect" Property="Shape.Fill" Value="BlueViolet"/>
|
||||
<Setter Property="Foreground" Value="#FFFFFFFF"/>
|
||||
</Trigger>
|
||||
<Trigger Property="ToggleButton.IsChecked" Value="True">
|
||||
<Setter TargetName="rect" Property="Shape.Fill" Value="BlueViolet" />
|
||||
<Setter Property="Foreground" Value="#FFFFFFFF" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user