diff --git a/Qwirkle/QwirkleViews/ConverterColor.cs b/Qwirkle/QwirkleViews/ConverterColor.cs index 8448cde..a48ac66 100644 --- a/Qwirkle/QwirkleViews/ConverterColor.cs +++ b/Qwirkle/QwirkleViews/ConverterColor.cs @@ -11,7 +11,7 @@ namespace Qwirkle.Converters string colorstring = (string)value; - if(string.IsNullOrWhiteSpace(colorstring)) return Colors.Transparent; + if (string.IsNullOrWhiteSpace(colorstring)) return Colors.Transparent; if (colorstring == "Yellow") return Colors.Yellow; if (colorstring == "Red") return Colors.Red; @@ -30,4 +30,22 @@ namespace Qwirkle.Converters throw new NotImplementedException(); } } + + public class RoundToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is not string) + return false; + + string sh = (string)value; + + return sh == "Round"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotSupportedException(); + } + } } diff --git a/Qwirkle/QwirkleViews/Views/TileCircle.xaml b/Qwirkle/QwirkleViews/Views/TileCircle.xaml index 7edc29f..f90838c 100644 --- a/Qwirkle/QwirkleViews/Views/TileCircle.xaml +++ b/Qwirkle/QwirkleViews/Views/TileCircle.xaml @@ -7,6 +7,7 @@ x:Name="root"> + @@ -19,10 +20,12 @@ HorizontalOptions="Center" BackgroundColor="Transparent"/> + WidthRequest="50" + Fill="{Binding Color, Source={x:Reference root}, Converter={StaticResource int2ColorConverter}}" + VerticalOptions="Center" + HorizontalOptions="Center" + IsVisible="{Binding Shape, Source={x:Reference root}, Converter={StaticResource roundToVisibilityConverter}}" /> + \ No newline at end of file