private void OnColorChangedProgramatically(object sender, PaletteColorChangedEventArgs e) { var flipViewItems = ColorPaletteFlipView.ItemsPanelRoot?.Children; if (flipViewItems != null) { foreach (FlipViewItem flipViewItem in flipViewItems) { if ((flipViewItem.Content as ColorPalettePageViewModel) == ColorPaletteFlipView.SelectedItem) { if (!(flipViewItem.ContentTemplateRoot is GridView currentGridView)) { continue; } int index = currentGridView.SelectedIndex; if (!(currentGridView.ItemsPanelRoot?.Children[index] is GridViewItem item)) { continue; } UpdateGridViewItemSelectionState(item); } } } ColorChanged?.Invoke(this, e); }
private void ColorPalette_OnColorChanged(object sender, PaletteColorChangedEventArgs e) { var inkDrawingAttributes = InkCanvas.InkPresenter.CopyDefaultDrawingAttributes(); inkDrawingAttributes.Color = e.NewColor; InkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(inkDrawingAttributes); CurrentColorBrush.Color = e.NewColor; }