コード例 #1
0
        private async void GenerateDisabledStateImage()
        {
            if (DesignMode.DesignModeEnabled)
            {
                return;
            }

            var wb = new WriteableBitmap(1, 1);
            await wb.FromBitmapImage((BitmapImage)NormalStateImageSource);
            await wb.WaitForLoadedAsync();
            wb.Grayscale(GeneratedDisabledStateGrayscaleAmount);
            _disabledStateImage.Source = wb;
        } 
コード例 #2
0
        private async void GenerateCheckedDisabledStateImage()
        {
            if (DesignMode.DesignModeEnabled)
            {
                return;
            }

            var wb = new WriteableBitmap(1, 1);

            if (CheckedStateImageSource != null)
            {
                await wb.FromBitmapImage((BitmapImage)CheckedStateImageSource);
                await wb.WaitForLoadedAsync();
                wb.Grayscale(GeneratedCheckedDisabledStateGrayscaleAmount);
            }
            else if (PressedStateImageSource != null)
            {
                await wb.FromBitmapImage((BitmapImage)PressedStateImageSource);
                await wb.WaitForLoadedAsync();
                wb.Grayscale(GeneratedCheckedDisabledStateGrayscaleAmount);
            }
            else if (NormalStateImageSource != null)
            {
                await wb.FromBitmapImage((BitmapImage)NormalStateImageSource);
                await wb.WaitForLoadedAsync();
                wb.Grayscale(GeneratedCheckedDisabledStateGrayscaleAmount);
            }

            _checkedDisabledStateImage.Source = wb;
        } 
コード例 #3
0
 private async void GenerateDisabledStateImage()
 {
     var wb = new WriteableBitmap(1, 1);
     await wb.FromBitmapImage((BitmapImage)NormalStateImageSource);
     await wb.WaitForLoaded();
     wb.Grayscale(GeneratedDisabledStateGrayscaleAmount);
     _disabledStateImage.Source = wb;
 }