public void SolidColorBrushDefinitionsAreCorrect()
        {
            Assert.AreEqual(
                "<AcrylicBrush Color=\"#FF000000\"\n    TintOpacity=\"0\"\n    contract8Present:TintLuminosityOpacity=\"0\"/>",
                AcrylicBrushSampleCodeFactory.GetAcrylicBrushXAMLCode(Colors.Black, 0, 0));

            Assert.AreEqual(
                "<AcrylicBrush Color=\"#FFFFFFFF\"\n    TintOpacity=\"0\"\n    contract8Present:TintLuminosityOpacity=\"0\"/>",
                AcrylicBrushSampleCodeFactory.GetAcrylicBrushXAMLCode(Colors.White, 0, 0));

            Assert.AreEqual(
                "<AcrylicBrush Color=\"#FFFFFFFF\"\n    TintOpacity=\"0\"\n    contract8Present:TintLuminosityOpacity=\"1\"/>",
                AcrylicBrushSampleCodeFactory.GetAcrylicBrushXAMLCode(Colors.White, 0, 1));

            Assert.AreEqual(
                "<AcrylicBrush Color=\"#FFFFFFFF\"\n    TintOpacity=\"1\"\n    contract8Present:TintLuminosityOpacity=\"0\"/>",

                AcrylicBrushSampleCodeFactory.GetAcrylicBrushXAMLCode(Colors.White, 1, 0));
            Assert.AreEqual(
                "<AcrylicBrush Color=\"#FFFFFFFF\"\n    TintOpacity=\"0\"\n    contract8Present:TintLuminosityOpacity=\"0.3\"/>",
                AcrylicBrushSampleCodeFactory.GetAcrylicBrushXAMLCode(Colors.White, 0, 0.30000000004));

            Assert.AreEqual(
                "<AcrylicBrush Color=\"#FFFFFFFF\"\n    TintOpacity=\"0.3\"\n    contract8Present:TintLuminosityOpacity=\"0\"/>",
                AcrylicBrushSampleCodeFactory.GetAcrylicBrushXAMLCode(Colors.White, 0.30000000004, 0));
        }
コード例 #2
0
        private void UpdateAcrylicBrushes()
        {
            double tintOpacity           = TintOpacity != null ? TintOpacity.Value : 0.5;
            double tintLuminosityOpacity = TintLuminosity != null ? TintLuminosity.Value : 0.5;

            HostBackDropBrush.TintColor     = Color.Color;
            HostBackDropBrush.FallbackColor = Color.Color;
            if (ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Media.AcrylicBrush", "TintLuminosityOpacity"))
            {
                HostBackDropBrush.TintLuminosityOpacity = tintLuminosityOpacity;
            }
            HostBackDropBrush.TintOpacity = tintOpacity;


            BackDropBrush.TintColor = Color.Color;
            if (ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Media.AcrylicBrush", "TintLuminosityOpacity"))
            {
                BackDropBrush.TintLuminosityOpacity = tintLuminosityOpacity;
            }
            BackDropBrush.TintOpacity = tintOpacity;

            AcrylicBrushSourceCode.Code = AcrylicBrushSampleCodeFactory.GetAcrylicBrushXAMLCode(Color.Color, tintOpacity, tintLuminosityOpacity);
        }