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; }
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; }
private async void GenerateDisabledStateImage() { var wb = new WriteableBitmap(1, 1); await wb.FromBitmapImage((BitmapImage)NormalStateImageSource); await wb.WaitForLoaded(); wb.Grayscale(GeneratedDisabledStateGrayscaleAmount); _disabledStateImage.Source = wb; }