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() { 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 GenerateCheckedHoverStateImage() { if (DesignMode.DesignModeEnabled) { return; } var wb = new WriteableBitmap(1, 1); if (CheckedStateImageSource != null) { await wb.FromBitmapImage((BitmapImage)CheckedStateImageSource); } else if (NormalStateImageSource != null) { await wb.FromBitmapImage((BitmapImage)NormalStateImageSource); } await wb.WaitForLoadedAsync(); wb.Lighten(GeneratedCheckedHoverStateLightenAmount); _checkedHoverStateImage.Source = wb; }
private async void GeneratePressedStateImage() { if (DesignMode.DesignModeEnabled) { return; } var wb = new WriteableBitmap(1, 1); await wb.FromBitmapImage((BitmapImage)NormalStateImageSource); await wb.WaitForLoadedAsync(); wb.Lighten(GeneratedPressedStateLightenAmount); _pressedStateImage.Source = wb; }