Windows phone 8 如何更改WP8中消息框的背景色

Windows phone 8 如何更改WP8中消息框的背景色,windows-phone-8,windows-phone-8-emulator,Windows Phone 8,Windows Phone 8 Emulator,实际上,windows phone提供了默认的黑色背景消息框。我已经在使用自定义消息框的工具包。它有背景属性,但我无法指定任何值。它给出了类型转换错误 希望有人能说出正确的值,我一直在尝试(0,0,0,0)/“grey”/colors.grey,但同样的错误 CustomMessageBox msgbox = new CustomMessageBox() { Caption = "Memory Race", Message ="This is custom message box!", Left

实际上,windows phone提供了默认的黑色背景消息框。我已经在使用自定义消息框的工具包。它有背景属性,但我无法指定任何值。它给出了类型转换错误

希望有人能说出正确的值,我一直在尝试(0,0,0,0)/“grey”/colors.grey,但同样的错误

CustomMessageBox msgbox = new CustomMessageBox()
{
Caption = "Memory Race",
Message ="This is custom message box!",
LeftButtonContent = "OK",
Background = "what?"
};

你可以设置背景色

Background =  new SolidColorBrush(Colors.Green);

你可以设置背景色

Background =  new SolidColorBrush(Colors.Green);

你可以设置背景色

Background =  new SolidColorBrush(Colors.Green);

你可以设置背景色

Background =  new SolidColorBrush(Colors.Green);

背景属性是一个彩色笔刷。 您必须这样做:

*.Background = new SolidColorBrush(ConvertStringToColor("#0D0D0E"));

private Color ConvertStringToColor(String hex)
    {
        //remove the # at the front
        hex = hex.Replace("#", "");

        byte a = 255;
        byte r = 255;
        byte g = 255;
        byte b = 255;

        int start = 0;

        //handle ARGB strings (8 characters long)
        if (hex.Length == 8)
        {
            a = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
            start = 2;
        }

        //convert RGB characters to bytes
        r = byte.Parse(hex.Substring(start, 2), System.Globalization.NumberStyles.HexNumber);
        g = byte.Parse(hex.Substring(start + 2, 2), System.Globalization.NumberStyles.HexNumber);
        b = byte.Parse(hex.Substring(start + 4, 2), System.Globalization.NumberStyles.HexNumber);

        return Color.FromArgb(a, r, g, b);
    }

背景属性是一个彩色笔刷。 您必须这样做:

*.Background = new SolidColorBrush(ConvertStringToColor("#0D0D0E"));

private Color ConvertStringToColor(String hex)
    {
        //remove the # at the front
        hex = hex.Replace("#", "");

        byte a = 255;
        byte r = 255;
        byte g = 255;
        byte b = 255;

        int start = 0;

        //handle ARGB strings (8 characters long)
        if (hex.Length == 8)
        {
            a = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
            start = 2;
        }

        //convert RGB characters to bytes
        r = byte.Parse(hex.Substring(start, 2), System.Globalization.NumberStyles.HexNumber);
        g = byte.Parse(hex.Substring(start + 2, 2), System.Globalization.NumberStyles.HexNumber);
        b = byte.Parse(hex.Substring(start + 4, 2), System.Globalization.NumberStyles.HexNumber);

        return Color.FromArgb(a, r, g, b);
    }

背景属性是一个彩色笔刷。 您必须这样做:

*.Background = new SolidColorBrush(ConvertStringToColor("#0D0D0E"));

private Color ConvertStringToColor(String hex)
    {
        //remove the # at the front
        hex = hex.Replace("#", "");

        byte a = 255;
        byte r = 255;
        byte g = 255;
        byte b = 255;

        int start = 0;

        //handle ARGB strings (8 characters long)
        if (hex.Length == 8)
        {
            a = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
            start = 2;
        }

        //convert RGB characters to bytes
        r = byte.Parse(hex.Substring(start, 2), System.Globalization.NumberStyles.HexNumber);
        g = byte.Parse(hex.Substring(start + 2, 2), System.Globalization.NumberStyles.HexNumber);
        b = byte.Parse(hex.Substring(start + 4, 2), System.Globalization.NumberStyles.HexNumber);

        return Color.FromArgb(a, r, g, b);
    }

背景属性是一个彩色笔刷。 您必须这样做:

*.Background = new SolidColorBrush(ConvertStringToColor("#0D0D0E"));

private Color ConvertStringToColor(String hex)
    {
        //remove the # at the front
        hex = hex.Replace("#", "");

        byte a = 255;
        byte r = 255;
        byte g = 255;
        byte b = 255;

        int start = 0;

        //handle ARGB strings (8 characters long)
        if (hex.Length == 8)
        {
            a = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
            start = 2;
        }

        //convert RGB characters to bytes
        r = byte.Parse(hex.Substring(start, 2), System.Globalization.NumberStyles.HexNumber);
        g = byte.Parse(hex.Substring(start + 2, 2), System.Globalization.NumberStyles.HexNumber);
        b = byte.Parse(hex.Substring(start + 4, 2), System.Globalization.NumberStyles.HexNumber);

        return Color.FromArgb(a, r, g, b);
    }


查看此项并设置自定义MessageBox的样式

查看此项并设置自定义MessageBox的样式

查看此项并设置自定义MessageBox的样式

查看此项并设置自定义MessageBox的样式

谢谢,如果我想设置背景图像怎么办?每当我将图像应用于背景时;它使其透明var bg=new ImageBrush();bg.ImageSource=新的位图图像(新的Uri(@“\Assets\bg.jpg”,UriKind.Relative));{Background=bg}是否在bg中获取图像?Background.ImageSource=new System.Windows.Media.Imaging.BitmapImage(新Uri(@“SplashScreenImage.jpg”,UriKind.Relative));是的,bg有图像,代码和你的一样,但我包括了图书馆谢谢你它的完美如果我想设置背景图像怎么办?每当我申请背景图像;它使其透明var bg=new ImageBrush();bg.ImageSource=新的位图图像(新的Uri(@“\Assets\bg.jpg”,UriKind.Relative));{Background=bg}是否在bg中获取图像?Background.ImageSource=new System.Windows.Media.Imaging.BitmapImage(新Uri(@“SplashScreenImage.jpg”,UriKind.Relative));是的,bg有图像,代码和你的一样,但我包括了图书馆谢谢你它的完美如果我想设置背景图像怎么办?每当我申请背景图像;它使其透明var bg=new ImageBrush();bg.ImageSource=新的位图图像(新的Uri(@“\Assets\bg.jpg”,UriKind.Relative));{Background=bg}是否在bg中获取图像?Background.ImageSource=new System.Windows.Media.Imaging.BitmapImage(新Uri(@“SplashScreenImage.jpg”,UriKind.Relative));是的,bg有图像,代码和你的一样,但我包括了图书馆谢谢你它的完美如果我想设置背景图像怎么办?每当我申请背景图像;它使其透明var bg=new ImageBrush();bg.ImageSource=新的位图图像(新的Uri(@“\Assets\bg.jpg”,UriKind.Relative));{Background=bg}是否在bg中获取图像?Background.ImageSource=new System.Windows.Media.Imaging.BitmapImage(新Uri(@“SplashScreenImage.jpg”,UriKind.Relative));是的,bg有图像,代码和你的相同,但我在申请背景图像时包括了Library;它使其透明var bg=new ImageBrush();bg.ImageSource=新的位图图像(新的Uri(@“\Assets\image.jpg”,UriKind.Relative));{Background=bg}如何设置背景图像?每当我将图像应用于背景时;它使其透明var bg=new ImageBrush();bg.ImageSource=新的位图图像(新的Uri(@“\Assets\image.jpg”,UriKind.Relative));{Background=bg}如何设置背景图像?每当我将图像应用于背景时;它使其透明var bg=new ImageBrush();bg.ImageSource=新的位图图像(新的Uri(@“\Assets\image.jpg”,UriKind.Relative));{Background=bg}如何设置背景图像?每当我将图像应用于背景时;它使其透明var bg=new ImageBrush();bg.ImageSource=新的位图图像(新的Uri(@“\Assets\image.jpg”,UriKind.Relative));{Background=bg}如何设置背景图像?