25 lines
976 B
C#
25 lines
976 B
C#
using System;
|
|
using System.Globalization;
|
|
using Avalonia.Data.Converters;
|
|
|
|
namespace Project_Periodensystem.View.Converters
|
|
{
|
|
public class RowToYConverter : IValueConverter
|
|
{
|
|
private const double TileHeight = 80;
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
=> (value is int r) ? r * TileHeight : 0;
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
=> throw new NotImplementedException();
|
|
}
|
|
|
|
public class ColumnToXConverter : IValueConverter
|
|
{
|
|
private const double TileWidth = 80;
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
=> (value is int c) ? c * TileWidth : 0;
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
=> throw new NotImplementedException();
|
|
}
|
|
}
|