BaconographyWP8.Converters.VoteIndicatorConverter.Convert C# (CSharp) Method

Convert() public method

public Convert ( object value, Type targetType, object parameter, System culture ) : object
value object
targetType System.Type
parameter object
culture System
return object
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var votable = value as VotableViewModel;
            if (votable != null && votable.LikeStatus != 0)
            {
                if (votable.LikeStatus == 1)
                {
                    return new TextBlock
                    {
                        Foreground = OrangeRed,
                        FontSize = 13,
                        Margin = new System.Windows.Thickness(0),
                        FontFamily = SegoeUISymbol,
                        Text = "\uE110"
                    };
                }
                else
                {
                    var newTextBlock = new TextBlock
                    {
                        Foreground = LightSkyBlue,
                        FontSize = 13,
                        Margin = new System.Windows.Thickness(0),
                        FontFamily = SegoeUISymbol,
                        Text = "\uE110"
                    };

                    newTextBlock.RenderTransform = new RotateTransform { Angle = 180, CenterX = 9, CenterY = 9 };
                    return newTextBlock;
                }
            }
            return null;
        }
VoteIndicatorConverter