Modified error handling to support ModelProperties with multiple errors to implement nested properties.
This commit is contained in:
@@ -26,7 +26,8 @@
|
||||
LoadCompleted="OnLandlordFrameLoadCompleted"/>
|
||||
</TabItem>
|
||||
<TabItem Visibility="Collapsed">
|
||||
<Frame Source="Pages/HousePage.xaml"/>
|
||||
<Frame Source="Pages/HousePage.xaml"
|
||||
LoadCompleted="OnHouseFrameLoadCompleted"/>
|
||||
</TabItem>
|
||||
<TabItem Visibility="Collapsed">
|
||||
<Frame Source="Pages/TenantsPage.xaml"/>
|
||||
|
||||
@@ -43,5 +43,11 @@ namespace UCalc
|
||||
var page = (LandlordPage) ((Frame) sender).Content;
|
||||
page.Model = Model.LandlordModel;
|
||||
}
|
||||
|
||||
private void OnHouseFrameLoadCompleted(object sender, NavigationEventArgs e)
|
||||
{
|
||||
var page = (HousePage) ((Frame) sender).Content;
|
||||
page.Model = Model.HouseModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,13 @@
|
||||
Height="16">
|
||||
|
||||
<UserControl.Resources>
|
||||
<local:ErrorToVisibilityConverter x:Key="ErrorToVisibilityConverter" />
|
||||
<local:ErrorToInVisibilityConverter x:Key="ErrorToInVisibilityConverter" />
|
||||
<local:ErrorsToVisibilityConverter x:Key="ErrorsToVisibilityConverter" />
|
||||
<local:ErrorsToInVisibilityConverter x:Key="ErrorsToInVisibilityConverter" />
|
||||
</UserControl.Resources>
|
||||
<StackPanel ToolTip="{Binding Path=Error, RelativeSource={RelativeSource AncestorType=local:ErrorIcon}}">
|
||||
|
||||
<StackPanel ToolTip="{Binding Path=ErrorsToolTip, RelativeSource={RelativeSource AncestorType=local:ErrorIcon}}">
|
||||
<Viewbox
|
||||
Visibility="{Binding Path=Error, RelativeSource={RelativeSource AncestorType=local:ErrorIcon}, Converter={StaticResource ErrorToInVisibilityConverter}}"
|
||||
Visibility="{Binding Path=Errors, RelativeSource={RelativeSource AncestorType=local:ErrorIcon}, Converter={StaticResource ErrorsToInVisibilityConverter}}"
|
||||
Stretch="Uniform">
|
||||
<Canvas Width="512" Height="512">
|
||||
<Canvas.RenderTransform>
|
||||
@@ -31,7 +32,7 @@
|
||||
</Viewbox>
|
||||
|
||||
<Viewbox
|
||||
Visibility="{Binding Path=Error, RelativeSource={RelativeSource AncestorType=local:ErrorIcon}, Converter={StaticResource ErrorToVisibilityConverter}}"
|
||||
Visibility="{Binding Path=Errors, RelativeSource={RelativeSource AncestorType=local:ErrorIcon}, Converter={StaticResource ErrorsToVisibilityConverter}}"
|
||||
Stretch="Uniform">
|
||||
<Canvas Width="512" Height="512">
|
||||
<Canvas.RenderTransform>
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using ucalc.Annotations;
|
||||
|
||||
namespace UCalc.Controls
|
||||
{
|
||||
public class ErrorToVisibilityConverter : IValueConverter
|
||||
public class ErrorsToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
if (value == null || "".Equals(value))
|
||||
{
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
|
||||
return Visibility.Visible;
|
||||
return (((ICollection<string>) value)?.Count ?? 0) == 0 ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter,
|
||||
@@ -23,9 +22,9 @@ namespace UCalc.Controls
|
||||
}
|
||||
}
|
||||
|
||||
public class ErrorToInVisibilityConverter : IValueConverter
|
||||
public class ErrorsToInVisibilityConverter : IValueConverter
|
||||
{
|
||||
private readonly ErrorToVisibilityConverter _converter = new ErrorToVisibilityConverter();
|
||||
private readonly ErrorsToVisibilityConverter _converter = new ErrorsToVisibilityConverter();
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
@@ -40,16 +39,35 @@ namespace UCalc.Controls
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ErrorIcon
|
||||
public partial class ErrorIcon : INotifyPropertyChanged
|
||||
{
|
||||
public string Error { get; set; }
|
||||
public ICollection<string> Errors { get; set; }
|
||||
|
||||
public static readonly DependencyProperty ErrorProperty = DependencyProperty.Register(
|
||||
"Error", typeof(string), typeof(ErrorIcon), new PropertyMetadata((string) null));
|
||||
public string ErrorsToolTip { get; private set; }
|
||||
|
||||
public static readonly DependencyProperty ErrorsProperty = DependencyProperty.Register(
|
||||
"Errors", typeof(ICollection<string>), typeof(ErrorIcon),
|
||||
new PropertyMetadata(null, OnErrorsChanged));
|
||||
|
||||
public ErrorIcon()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private static void OnErrorsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var self = (ErrorIcon) d;
|
||||
var newErrors = (ICollection<string>) e.NewValue;
|
||||
self.ErrorsToolTip = newErrors.Count > 0 ? string.Join("\n", newErrors) : null;
|
||||
self.OnPropertyChanged("ErrorsToolTip");
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using UCalc.Data;
|
||||
|
||||
namespace UCalc.Models
|
||||
{
|
||||
public class AddressModel : Model
|
||||
{
|
||||
private readonly Address _data;
|
||||
public ModelProperty<string> Street { get; }
|
||||
public ModelProperty<string> HouseNumber { get; }
|
||||
public ModelProperty<string> City { get; }
|
||||
public ModelProperty<string> Postcode { get; }
|
||||
|
||||
public AddressModel(Address data)
|
||||
{
|
||||
_data = data;
|
||||
|
||||
Street = Add(new ModelProperty<string>("Straße", _data.Street, ModelPropertyValidators.IsNotEmpty));
|
||||
HouseNumber =
|
||||
Add(new ModelProperty<string>("Hausnummer", _data.HouseNumber, ModelPropertyValidators.IsNotEmpty));
|
||||
City = Add(new ModelProperty<string>("Stadt", _data.City, ModelPropertyValidators.IsNotEmpty));
|
||||
Postcode = Add(new ModelProperty<string>("PLZ", _data.Postcode, ModelPropertyValidators.IsNotEmpty));
|
||||
}
|
||||
|
||||
public override void Apply()
|
||||
{
|
||||
_data.Street = Street.Value;
|
||||
Street.ResetModified();
|
||||
|
||||
_data.HouseNumber = HouseNumber.Value;
|
||||
HouseNumber.ResetModified();
|
||||
|
||||
_data.City = City.Value;
|
||||
City.ResetModified();
|
||||
|
||||
_data.Postcode = Postcode.Value;
|
||||
Postcode.ResetModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using UCalc.Data;
|
||||
|
||||
namespace UCalc.Models
|
||||
{
|
||||
public class BankAccountModel : Model
|
||||
{
|
||||
private readonly BankAccount _data;
|
||||
public ModelProperty<string> Iban { get; }
|
||||
public ModelProperty<string> Bic { get; }
|
||||
public ModelProperty<string> BankName { get; }
|
||||
|
||||
public BankAccountModel(BankAccount data)
|
||||
{
|
||||
_data = data;
|
||||
|
||||
Iban = Add(new ModelProperty<string>("IBAN", _data.Iban, ModelPropertyValidators.IsNotEmpty));
|
||||
Bic = Add(new ModelProperty<string>("BIC", _data.Bic, ModelPropertyValidators.IsNotEmpty));
|
||||
BankName = Add(new ModelProperty<string>("Name der Bank", _data.BankName,
|
||||
ModelPropertyValidators.IsNotEmpty));
|
||||
}
|
||||
|
||||
public override void Apply()
|
||||
{
|
||||
_data.Iban = Iban.Value;
|
||||
Iban.ResetModified();
|
||||
|
||||
_data.Bic = Bic.Value;
|
||||
Bic.ResetModified();
|
||||
|
||||
_data.BankName = BankName.Value;
|
||||
BankName.ResetModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,18 @@ namespace UCalc.Models
|
||||
public class BillingModel : Model
|
||||
{
|
||||
public LandlordModel LandlordModel { get; }
|
||||
public HouseModel HouseModel { get; }
|
||||
|
||||
public BillingModel(Billing billing)
|
||||
{
|
||||
LandlordModel = new LandlordModel(billing.Landlord);
|
||||
|
||||
Properties = LandlordModel.Properties;
|
||||
HouseModel = new HouseModel(billing.House);
|
||||
}
|
||||
|
||||
public override void Apply()
|
||||
{
|
||||
LandlordModel.Apply();
|
||||
HouseModel.Apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UCalc.Data;
|
||||
|
||||
namespace UCalc.Models
|
||||
{
|
||||
public class FlatModel : Model
|
||||
{
|
||||
public Flat Data { get; }
|
||||
public ModelProperty<string> Name { get; }
|
||||
public ModelProperty<string> Size { get; }
|
||||
|
||||
public FlatModel(Flat data, IReadOnlyList<Flat> flats)
|
||||
{
|
||||
Data = data;
|
||||
|
||||
Name = Add(new ModelProperty<string>("Name", Data.Name, (name, value) =>
|
||||
{
|
||||
var error = ModelPropertyValidators.IsNotEmpty(name, value);
|
||||
|
||||
if (error == "" && flats.Any(flat => !ReferenceEquals(flat, Data) && flat.Name == value))
|
||||
{
|
||||
error = $"{name}: Der Wert \"{value}\" ist nicht eindeutig.";
|
||||
}
|
||||
|
||||
return error;
|
||||
}));
|
||||
Size = Add(new ModelProperty<string>("Größe", Data.Size.ToString(), ModelPropertyValidators.IsNaturalInt));
|
||||
}
|
||||
|
||||
public override void Apply()
|
||||
{
|
||||
Data.Name = Name.Value;
|
||||
Name.ResetModified();
|
||||
|
||||
Data.Size = int.TryParse(Size.Value, out var n) && n > 0 ? n : 0;
|
||||
Size.ResetModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,16 +5,53 @@ namespace UCalc.Models
|
||||
public class HouseModel : Model
|
||||
{
|
||||
private readonly House _data;
|
||||
public ModelProperty<string> Street { get; }
|
||||
public ModelProperty<string> HouseNumber { get; }
|
||||
public ModelProperty<string> City { get; }
|
||||
public ModelProperty<string> Postcode { get; }
|
||||
|
||||
// TODO: Flats?
|
||||
public NestedModelProperty<AddressModel> Address { get; }
|
||||
public MultiModelProperty<FlatModel> Flats { get; }
|
||||
|
||||
public HouseModel(House data)
|
||||
{
|
||||
_data = data;
|
||||
|
||||
Address = Add(new NestedModelProperty<AddressModel>(new AddressModel(_data.Address)));
|
||||
Flats = Add(new MultiModelProperty<FlatModel>());
|
||||
|
||||
foreach (var flat in data.Flats)
|
||||
{
|
||||
Flats.Add(new FlatModel(flat, _data.Flats));
|
||||
}
|
||||
}
|
||||
|
||||
public override void Apply()
|
||||
{
|
||||
Address.Model.Apply();
|
||||
|
||||
foreach (var model in Flats.Models)
|
||||
{
|
||||
model.Apply();
|
||||
}
|
||||
}
|
||||
|
||||
public FlatModel AddFlat()
|
||||
{
|
||||
var flat = new Flat {Name = $"Wohnung {_data.Flats.Count + 1}"};
|
||||
_data.Flats.Add(flat);
|
||||
|
||||
var model = new FlatModel(flat, _data.Flats);
|
||||
Flats.Add(model);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
public void RemoveFlat(FlatModel model)
|
||||
{
|
||||
_data.Flats.Remove(model.Data);
|
||||
|
||||
Flats.Remove(model);
|
||||
|
||||
if (model.Errors.Count > 0)
|
||||
{
|
||||
OnPropertyChanged("Errors");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,71 +9,39 @@ namespace UCalc.Models
|
||||
public ModelProperty<string> Name { get; }
|
||||
public ModelProperty<string> MailAddress { get; }
|
||||
public ModelProperty<string> Phone { get; }
|
||||
public ModelProperty<string> Street { get; }
|
||||
public ModelProperty<string> HouseNumber { get; }
|
||||
public ModelProperty<string> City { get; }
|
||||
public ModelProperty<string> Postcode { get; }
|
||||
public ModelProperty<string> Iban { get; }
|
||||
public ModelProperty<string> Bic { get; }
|
||||
public ModelProperty<string> BankName { get; }
|
||||
public NestedModelProperty<AddressModel> Address { get; }
|
||||
public NestedModelProperty<BankAccountModel> BankAccount { get; }
|
||||
|
||||
public LandlordModel(Landlord data)
|
||||
{
|
||||
_data = data;
|
||||
|
||||
Salutation = new ModelProperty<int>(this, (int) _data.Salutation, null);
|
||||
Name = new ModelProperty<string>(this, _data.Name, ModelPropertyValidators.IsNotEmpty);
|
||||
MailAddress = new ModelProperty<string>(this, _data.MailAddress, ModelPropertyValidators.IsNotEmpty);
|
||||
Phone = new ModelProperty<string>(this, _data.Phone, ModelPropertyValidators.IsNotEmpty);
|
||||
Street = new ModelProperty<string>(this, _data.Address.Street, ModelPropertyValidators.IsNotEmpty);
|
||||
HouseNumber =
|
||||
new ModelProperty<string>(this, _data.Address.HouseNumber, ModelPropertyValidators.IsNotEmpty);
|
||||
City = new ModelProperty<string>(this, _data.Address.City, ModelPropertyValidators.IsNotEmpty);
|
||||
Postcode = new ModelProperty<string>(this, _data.Address.Postcode, ModelPropertyValidators.IsNotEmpty);
|
||||
Iban = new ModelProperty<string>(this, _data.BankAccount.Iban, ModelPropertyValidators.IsNotEmpty);
|
||||
Bic = new ModelProperty<string>(this, _data.BankAccount.Bic, ModelPropertyValidators.IsNotEmpty);
|
||||
BankName = new ModelProperty<string>(this, _data.BankAccount.BankName, ModelPropertyValidators.IsNotEmpty);
|
||||
|
||||
Properties = new ModelProperty[]
|
||||
{Salutation, Name, MailAddress, Phone, Street, HouseNumber, City, Postcode, Iban, Bic, BankName};
|
||||
Salutation = Add(new ModelProperty<int>("Anrede", (int) _data.Salutation, null));
|
||||
Name = Add(new ModelProperty<string>("Name", _data.Name, ModelPropertyValidators.IsNotEmpty));
|
||||
MailAddress =
|
||||
Add(new ModelProperty<string>("Email Adresse", _data.MailAddress, ModelPropertyValidators.IsNotEmpty));
|
||||
Phone = Add(new ModelProperty<string>("Telefonnummer", _data.Phone, ModelPropertyValidators.IsNotEmpty));
|
||||
Address = Add(new NestedModelProperty<AddressModel>(new AddressModel(_data.Address)));
|
||||
BankAccount = Add(new NestedModelProperty<BankAccountModel>(new BankAccountModel(_data.BankAccount)));
|
||||
}
|
||||
|
||||
public override void Apply()
|
||||
{
|
||||
base.Apply();
|
||||
|
||||
_data.Salutation = (Salutation) Salutation.Value;
|
||||
Salutation.Modified = false;
|
||||
Salutation.ResetModified();
|
||||
|
||||
_data.Name = Name.Value;
|
||||
Name.Modified = false;
|
||||
Name.ResetModified();
|
||||
|
||||
_data.MailAddress = MailAddress.Value;
|
||||
MailAddress.Modified = false;
|
||||
MailAddress.ResetModified();
|
||||
|
||||
_data.Phone = Phone.Value;
|
||||
Phone.Modified = false;
|
||||
Phone.ResetModified();
|
||||
|
||||
_data.Address.Street = Street.Value;
|
||||
Street.Modified = false;
|
||||
Address.Model.Apply();
|
||||
|
||||
_data.Address.HouseNumber = HouseNumber.Value;
|
||||
HouseNumber.Modified = false;
|
||||
|
||||
_data.Address.City = City.Value;
|
||||
City.Modified = false;
|
||||
|
||||
_data.Address.Postcode = Postcode.Value;
|
||||
Postcode.Modified = false;
|
||||
|
||||
_data.BankAccount.Iban = Iban.Value;
|
||||
Iban.Modified = false;
|
||||
|
||||
_data.BankAccount.Bic = Bic.Value;
|
||||
Bic.Modified = false;
|
||||
|
||||
_data.BankAccount.BankName = BankName.Value;
|
||||
BankName.Modified = false;
|
||||
BankAccount.Model.Apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
+175
-59
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -6,14 +8,107 @@ using ucalc.Annotations;
|
||||
|
||||
namespace UCalc.Models
|
||||
{
|
||||
public class ModelProperty : INotifyPropertyChanged
|
||||
public abstract class ModelBaseProperty : INotifyPropertyChanged
|
||||
{
|
||||
private readonly Model _model;
|
||||
private object _value;
|
||||
private string _error;
|
||||
private readonly Func<object, string> _validate;
|
||||
protected static readonly List<string> EmptyList = new List<string>();
|
||||
public abstract IReadOnlyCollection<string> Errors { get; }
|
||||
public abstract bool Modified { get; }
|
||||
|
||||
public object Value
|
||||
protected void OnChildPropertyChanged(object sender, PropertyChangedEventArgs args)
|
||||
{
|
||||
if (args.PropertyName == "Errors" || args.PropertyName == "Modified")
|
||||
{
|
||||
OnPropertyChanged(args.PropertyName);
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
public class NestedModelProperty<T> : ModelBaseProperty where T : Model
|
||||
{
|
||||
public T Model { get; }
|
||||
|
||||
public NestedModelProperty(T model)
|
||||
{
|
||||
Model = model;
|
||||
|
||||
Model.PropertyChanged += OnChildPropertyChanged;
|
||||
}
|
||||
|
||||
public override IReadOnlyCollection<string> Errors => Model.Errors;
|
||||
|
||||
public override bool Modified => Model.Modified;
|
||||
}
|
||||
|
||||
public class MultiModelProperty<T> : ModelBaseProperty where T : Model
|
||||
{
|
||||
private readonly ObservableCollection<T> _models;
|
||||
|
||||
public MultiModelProperty()
|
||||
{
|
||||
_models = new ObservableCollection<T>();
|
||||
}
|
||||
|
||||
public void Add(T model)
|
||||
{
|
||||
_models.Add(model);
|
||||
|
||||
model.PropertyChanged += OnChildPropertyChanged;
|
||||
|
||||
if (model.Errors.Count > 0)
|
||||
{
|
||||
OnPropertyChanged("Errors");
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove(T model)
|
||||
{
|
||||
model.PropertyChanged -= OnChildPropertyChanged;
|
||||
|
||||
_models.Remove(model);
|
||||
|
||||
if (model.Errors.Count > 0)
|
||||
{
|
||||
OnPropertyChanged("Errors");
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyList<T> Models => _models;
|
||||
|
||||
public override IReadOnlyCollection<string> Errors
|
||||
{
|
||||
get
|
||||
{
|
||||
var errors = new List<string>();
|
||||
|
||||
foreach (var model in _models)
|
||||
{
|
||||
errors.AddRange(model.Errors);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Modified => _models.Select(model => model.Modified).Any();
|
||||
}
|
||||
|
||||
public class ModelProperty<T> : ModelBaseProperty
|
||||
{
|
||||
public string Name { get; }
|
||||
private T _value;
|
||||
private readonly List<string> _errors;
|
||||
private readonly Func<string, T, string> _validate;
|
||||
private bool _modified;
|
||||
|
||||
public T Value
|
||||
{
|
||||
get => _value;
|
||||
set
|
||||
@@ -23,94 +118,115 @@ namespace UCalc.Models
|
||||
return;
|
||||
}
|
||||
|
||||
var oldError = Error;
|
||||
Error = _validate?.Invoke(value);
|
||||
if (oldError == null && Error != null || oldError != null && Error == null)
|
||||
var oldError = _errors[0];
|
||||
_errors[0] = _validate?.Invoke(Name, value) ?? "";
|
||||
|
||||
if (oldError != _errors[0])
|
||||
{
|
||||
_model.OnPropertyChanged("ErrorCount");
|
||||
OnPropertyChanged("Errors");
|
||||
}
|
||||
|
||||
Modified = true;
|
||||
if (!_modified)
|
||||
{
|
||||
OnPropertyChanged("Modified");
|
||||
}
|
||||
|
||||
_modified = true;
|
||||
_value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Error
|
||||
public ModelProperty(string name, T value, Func<string, T, string> validate)
|
||||
{
|
||||
get => _error;
|
||||
private set
|
||||
{
|
||||
if (_error == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_error = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Modified { get; set; }
|
||||
|
||||
public ModelProperty(Model model, object value, Func<object, string> validate)
|
||||
{
|
||||
_model = model;
|
||||
Name = name;
|
||||
_value = value;
|
||||
_error = validate?.Invoke(value);
|
||||
_errors = new List<string> {validate?.Invoke(Name, _value) ?? ""};
|
||||
_validate = validate;
|
||||
_modified = false;
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public override IReadOnlyCollection<string> Errors => _errors[0] != "" ? _errors : EmptyList;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
public override bool Modified => _modified;
|
||||
|
||||
public class ModelProperty<T> : ModelProperty
|
||||
{
|
||||
public new T Value
|
||||
{
|
||||
get => (T) base.Value;
|
||||
set => base.Value = value;
|
||||
}
|
||||
|
||||
public ModelProperty(Model model, T value, Func<T, string> validate) : base(model, value,
|
||||
validate == null ? (Func<object, string>) null : o => validate((T) o))
|
||||
public void ResetModified()
|
||||
{
|
||||
_modified = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ModelPropertyValidators
|
||||
{
|
||||
public static string IsNotEmpty(string data)
|
||||
public static string IsNotEmpty(string name, string data)
|
||||
{
|
||||
return string.IsNullOrEmpty(data) ? "Geben Sie einen Wert ein" : null;
|
||||
return string.IsNullOrEmpty(data) ? $"{name}: Geben Sie einen Wert ein." : "";
|
||||
}
|
||||
|
||||
public static string IsNaturalInt(string name, string data)
|
||||
{
|
||||
return !int.TryParse(data, out var n) || n <= 0
|
||||
? $"{name}: Der eingegebene Wert ist keine gültige positive Zahl > 0."
|
||||
: "";
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class Model : INotifyPropertyChanged
|
||||
{
|
||||
public ModelProperty[] Properties { get; protected set; }
|
||||
private readonly List<ModelBaseProperty> _properties;
|
||||
|
||||
public bool Modified => Properties.Select(property => property.Modified).Any();
|
||||
|
||||
public int ErrorCount => Properties.Select(property => string.IsNullOrEmpty(property.Error) ? 0 : 1).Sum();
|
||||
|
||||
public virtual void Apply()
|
||||
protected Model()
|
||||
{
|
||||
if (ErrorCount > 0)
|
||||
_properties = new List<ModelBaseProperty>();
|
||||
|
||||
PropertyChanged += (sender, args) =>
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
if (args.PropertyName == "Errors")
|
||||
{
|
||||
OnPropertyChanged("ErrorCount");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected T Add<T>(T property) where T : ModelBaseProperty
|
||||
{
|
||||
_properties.Add(property);
|
||||
|
||||
property.PropertyChanged += (sender, args) =>
|
||||
{
|
||||
if (args.PropertyName == "Errors" || args.PropertyName == "Modified")
|
||||
{
|
||||
OnPropertyChanged(args.PropertyName);
|
||||
}
|
||||
};
|
||||
|
||||
return property;
|
||||
}
|
||||
|
||||
public bool Modified => _properties.Select(property => property.Modified).Any();
|
||||
|
||||
public IReadOnlyCollection<string> Errors
|
||||
{
|
||||
get
|
||||
{
|
||||
var errors = new List<string>();
|
||||
|
||||
foreach (var property in _properties)
|
||||
{
|
||||
errors.AddRange(property.Errors);
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
|
||||
public int ErrorCount => Errors.Count;
|
||||
|
||||
public abstract void Apply();
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
public void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
+153
-3
@@ -3,7 +3,157 @@
|
||||
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:UCalc.Pages"
|
||||
xmlns:local="clr-namespace:UCalc"
|
||||
xmlns:pages="clr-namespace:UCalc.Pages"
|
||||
xmlns:controls="clr-namespace:UCalc.Controls"
|
||||
mc:Ignorable="d">
|
||||
<Grid />
|
||||
</Page>
|
||||
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel>
|
||||
<controls:SectionHeader Header="Adresse des Hauses" />
|
||||
|
||||
<DockPanel Margin="12, 8, 12, 0">
|
||||
<Label DockPanel.Dock="Left"
|
||||
Content="Straße:"
|
||||
Width="200"
|
||||
Foreground="{x:Static local:Constants.SubMainColor}" />
|
||||
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Errors="{Binding Path=Model.Address.Model.Street.Errors, RelativeSource={RelativeSource AncestorType=pages:HousePage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
MinHeight="22"
|
||||
Text="{Binding Path=Model.Address.Model.Street.Value, RelativeSource={RelativeSource AncestorType=pages:HousePage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Margin="12, 8, 12, 0">
|
||||
<Label DockPanel.Dock="Left"
|
||||
Content="Hausnummer:"
|
||||
Width="200"
|
||||
Foreground="{x:Static local:Constants.SubMainColor}" />
|
||||
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Errors="{Binding Path=Model.Address.Model.HouseNumber.Errors, RelativeSource={RelativeSource AncestorType=pages:HousePage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
MinHeight="22"
|
||||
Text="{Binding Path=Model.Address.Model.HouseNumber.Value, RelativeSource={RelativeSource AncestorType=pages:HousePage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Margin="12, 8, 12, 0">
|
||||
<Label DockPanel.Dock="Left"
|
||||
Content="Stadt:"
|
||||
Width="200"
|
||||
Foreground="{x:Static local:Constants.SubMainColor}" />
|
||||
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Errors="{Binding Path=Model.Address.Model.City.Errors, RelativeSource={RelativeSource AncestorType=pages:HousePage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
MinHeight="22"
|
||||
Text="{Binding Path=Model.Address.Model.City.Value, RelativeSource={RelativeSource AncestorType=pages:HousePage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Margin="12, 8, 12, 0">
|
||||
<Label DockPanel.Dock="Left"
|
||||
Content="PLZ:"
|
||||
Width="200"
|
||||
Foreground="{x:Static local:Constants.SubMainColor}" />
|
||||
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Errors="{Binding Path=Model.Address.Model.Postcode.Errors, RelativeSource={RelativeSource AncestorType=pages:HousePage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
MinHeight="22"
|
||||
Text="{Binding Path=Model.Address.Model.Postcode.Value, RelativeSource={RelativeSource AncestorType=pages:HousePage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DockPanel>
|
||||
|
||||
<controls:SectionHeader Header="Wohnungen"
|
||||
Margin="0, 12, 0, 0" />
|
||||
|
||||
<controls:HighlightButton Margin="12, 0, 12, 8"
|
||||
HighlightForeground="{x:Static local:Constants.SubMainColor}"
|
||||
HighlightBackground="{x:Static local:Constants.MainColor}"
|
||||
Click="OnAddFlatClick">
|
||||
<Viewbox Width="24"
|
||||
Height="24"
|
||||
Margin="12, 12, 6, 12"
|
||||
Stretch="Uniform">
|
||||
<Canvas Width="512" Height="512">
|
||||
<Canvas.RenderTransform>
|
||||
<TranslateTransform X="0" Y="0" />
|
||||
</Canvas.RenderTransform>
|
||||
<Path>
|
||||
<Path.Data>
|
||||
<PathGeometry
|
||||
Figures="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"
|
||||
FillRule="NonZero" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
|
||||
<Label Content="Wohnung hinzufügen"
|
||||
Margin="0, 12, 12, 12" />
|
||||
</controls:HighlightButton>
|
||||
|
||||
<ItemsControl
|
||||
ItemsSource="{Binding Path=Model.Flats.Models, RelativeSource={RelativeSource AncestorType=pages:HousePage}}"
|
||||
Margin="12, 0, 12, 12">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<DockPanel>
|
||||
<controls:HighlightButton DockPanel.Dock="Right"
|
||||
HighlightForeground="Red"
|
||||
HighlightBackground="White"
|
||||
Click="OnFlatDeleteClick">
|
||||
<Viewbox Width="24"
|
||||
Height="24"
|
||||
Margin="8, 12, 8, 12"
|
||||
Stretch="Uniform">
|
||||
<Canvas Width="448" Height="512">
|
||||
<Canvas.RenderTransform>
|
||||
<TranslateTransform X="0" Y="0" />
|
||||
</Canvas.RenderTransform>
|
||||
<Path>
|
||||
<Path.Data>
|
||||
<PathGeometry
|
||||
Figures="M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z"
|
||||
FillRule="NonZero" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</controls:HighlightButton>
|
||||
|
||||
<controls:HighlightButton HighlightForeground="{x:Static local:Constants.SubMainColor}"
|
||||
HighlightBackground="{x:Static local:Constants.MainColor}">
|
||||
|
||||
<controls:ErrorIcon Errors="{Binding Errors}"
|
||||
DockPanel.Dock="Left"
|
||||
Margin="12, 12, 8, 12" />
|
||||
|
||||
<Label Content="{Binding Name.Value}"
|
||||
VerticalAlignment="Center" />
|
||||
</controls:HighlightButton>
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
</Page>
|
||||
@@ -1,10 +1,32 @@
|
||||
namespace UCalc.Pages
|
||||
using System.Windows;
|
||||
using UCalc.Controls;
|
||||
using UCalc.Models;
|
||||
|
||||
namespace UCalc.Pages
|
||||
{
|
||||
public partial class HousePage
|
||||
{
|
||||
public HouseModel Model { get; set; }
|
||||
|
||||
public HousePage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnAddFlatClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Model.AddFlat();
|
||||
}
|
||||
|
||||
private void OnFlatDeleteClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var flatModel = (FlatModel) ((HighlightButton) sender).DataContext;
|
||||
|
||||
if (MessageBox.Show($"Möchten Sie die Wohnung \"{flatModel.Data.Name}\" wirlick löschen?", "Löschen?",
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
|
||||
{
|
||||
Model.RemoveFlat(flatModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
xmlns:local="clr-namespace:UCalc"
|
||||
xmlns:pages="clr-namespace:UCalc.Pages"
|
||||
xmlns:controls="clr-namespace:UCalc.Controls"
|
||||
xmlns:data="clr-namespace:UCalc.Data"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
|
||||
@@ -19,7 +18,7 @@
|
||||
Content="Anrede:"
|
||||
Width="200"
|
||||
Foreground="{x:Static local:Constants.SubMainColor}" />
|
||||
|
||||
|
||||
<ComboBox Margin="0, 0, 28, 0" /> <!-- TODO -->
|
||||
</DockPanel>
|
||||
|
||||
@@ -32,7 +31,7 @@
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Error="{Binding Path=Model.Name.Error, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
Errors="{Binding Path=Model.Name.Errors, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
@@ -49,7 +48,7 @@
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Error="{Binding Path=Model.Phone.Error, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
Errors="{Binding Path=Model.Phone.Errors, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
@@ -66,16 +65,16 @@
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Error="{Binding Path=Model.MailAddress.Error, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
Errors="{Binding Path=Model.MailAddress.Errors, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
MinHeight="22"
|
||||
Text="{Binding Path=Model.MailAddress.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DockPanel>
|
||||
|
||||
|
||||
<controls:SectionHeader Header="Adresse des Eigentümers"
|
||||
Margin="0, 12, 0, 0"/>
|
||||
Margin="0, 12, 0, 0" />
|
||||
|
||||
<DockPanel Margin="12, 8, 12, 0">
|
||||
<Label DockPanel.Dock="Left"
|
||||
@@ -86,12 +85,12 @@
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Error="{Binding Path=Model.Street.Error, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
Errors="{Binding Path=Model.Address.Model.Street.Errors, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
MinHeight="22"
|
||||
Text="{Binding Path=Model.Street.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
Text="{Binding Path=Model.Address.Model.Street.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Margin="12, 8, 12, 0">
|
||||
@@ -103,12 +102,12 @@
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Error="{Binding Path=Model.HouseNumber.Error, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
Errors="{Binding Path=Model.Address.Model.HouseNumber.Errors, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
MinHeight="22"
|
||||
Text="{Binding Path=Model.HouseNumber.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
Text="{Binding Path=Model.Address.Model.HouseNumber.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Margin="12, 8, 12, 0">
|
||||
@@ -120,12 +119,12 @@
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Error="{Binding Path=Model.City.Error, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
Errors="{Binding Path=Model.Address.Model.City.Errors, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
MinHeight="22"
|
||||
Text="{Binding Path=Model.City.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
Text="{Binding Path=Model.Address.Model.City.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Margin="12, 8, 12, 0">
|
||||
@@ -137,16 +136,16 @@
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Error="{Binding Path=Model.Postcode.Error, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
Errors="{Binding Path=Model.Address.Model.Postcode.Errors, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
MinHeight="22"
|
||||
Text="{Binding Path=Model.Postcode.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
Text="{Binding Path=Model.Address.Model.Postcode.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DockPanel>
|
||||
|
||||
|
||||
<controls:SectionHeader Header="Bankdaten des Eigentümers"
|
||||
Margin="0, 12, 0, 0"/>
|
||||
Margin="0, 12, 0, 0" />
|
||||
|
||||
<DockPanel Margin="12, 8, 12, 0">
|
||||
<Label DockPanel.Dock="Left"
|
||||
@@ -157,12 +156,12 @@
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Error="{Binding Path=Model.Iban.Error, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
Errors="{Binding Path=Model.BankAccount.Model.Iban.Errors, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
MinHeight="22"
|
||||
Text="{Binding Path=Model.Iban.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
Text="{Binding Path=Model.BankAccount.Model.Iban.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Margin="12, 8, 12, 0">
|
||||
@@ -174,12 +173,12 @@
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Error="{Binding Path=Model.Bic.Error, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
Errors="{Binding Path=Model.BankAccount.Model.Bic.Errors, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
MinHeight="22"
|
||||
Text="{Binding Path=Model.Bic.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
Text="{Binding Path=Model.BankAccount.Model.Bic.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Margin="12, 8, 12, 12">
|
||||
@@ -191,12 +190,12 @@
|
||||
<controls:ErrorIcon Margin="12, 0, 0, 0"
|
||||
DockPanel.Dock="Right"
|
||||
VerticalAlignment="Center"
|
||||
Error="{Binding Path=Model.BankName.Error, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
Errors="{Binding Path=Model.BankAccount.Model.BankName.Errors, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}}" />
|
||||
|
||||
<TextBox
|
||||
VerticalAlignment="Center"
|
||||
MinHeight="22"
|
||||
Text="{Binding Path=Model.BankName.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
Text="{Binding Path=Model.BankAccount.Model.BankName.Value, RelativeSource={RelativeSource AncestorType=pages:LandlordPage}, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</DockPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
@@ -116,8 +116,7 @@
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
|
||||
<controls:ErrorCounter x:Name="LandlordErrorCounter"
|
||||
DockPanel.Dock="Right"
|
||||
<controls:ErrorCounter DockPanel.Dock="Right"
|
||||
Margin="0, 12, 12, 12"
|
||||
VerticalAlignment="Center"
|
||||
Model="{Binding Path=Model.LandlordModel, RelativeSource={RelativeSource AncestorType=pages:SideBar}}"/>
|
||||
@@ -154,6 +153,11 @@
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
|
||||
<controls:ErrorCounter DockPanel.Dock="Right"
|
||||
Margin="0, 12, 12, 12"
|
||||
VerticalAlignment="Center"
|
||||
Model="{Binding Path=Model.HouseModel, RelativeSource={RelativeSource AncestorType=pages:SideBar}}"/>
|
||||
|
||||
<Label Content="Haus"
|
||||
Margin="0, 12, 12, 12"
|
||||
VerticalAlignment="Center"
|
||||
|
||||
Reference in New Issue
Block a user