using System;
using System.Collections.Generic;
using System.Windows.Data;
using System.Windows;
using System.Globalization;

namespace Datenbindung
{
    [ValueConversion(typeof(DateTime), typeof(String))]
    public class IntConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int n = (int)value;
            return n.ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string str = value as string;
            int n;
            if (Int32.TryParse(str, out n))
            {
                return n;
            }
            return DependencyProperty.UnsetValue;
        }
    }



   public class Score
   {
      private string playerName;
      private int playerScore;

      public Score(string name, int points)
      {
         playerName = name;
         playerScore = points;
      }

      public string PlayerName
      {
         get { return playerName; }
         set { playerName = value; }
      }

      public int PlayerScore
      {
         get { return playerScore; }
         set { playerScore = value; }
      }

      public override string ToString()
      {
         return (playerName + " hat " + playerScore + " Punkte erreicht");
      }
   }
}
