private void myColorButton_Click(Microsoft.UI.Xaml.Controls.SplitButton sender, Microsoft.UI.Xaml.Controls.SplitButtonClickEventArgs args)
        {
            var rectangle = (Windows.UI.Xaml.Shapes.Rectangle)sender.Content;
            var color     = ((Windows.UI.Xaml.Media.SolidColorBrush)rectangle.Fill).Color;

            myRichEditBox.Document.Selection.CharacterFormat.ForegroundColor = color;
        }
Example #2
0
        public async Task VerifyDefaultsAndBasicSetting()
        {
            SplitButton splitButton = null;
            Flyout      flyout      = null;
            TestCommand command     = null;
            int         parameter   = 0;

            await RunOnUIThread.ExecuteAsync(() =>
            {
                flyout  = new Flyout();
                command = new TestCommand();

                splitButton = new SplitButton();
                Verify.IsNotNull(splitButton);

                // Verify Defaults
                Verify.IsNull(splitButton.Flyout);
                Verify.IsNull(splitButton.Command);
                Verify.IsNull(splitButton.CommandParameter);

                // Verify basic setters
                splitButton.Flyout           = flyout;
                splitButton.Command          = command;
                splitButton.CommandParameter = parameter;
            });

            await RunOnUIThread.ExecuteAsync(() =>
            {
                Verify.AreEqual(splitButton.Flyout, flyout);
                Verify.AreEqual(splitButton.Command, command);
                Verify.AreEqual(splitButton.CommandParameter, parameter);
            });
        }
Example #3
0
        private void myColorButton_Click(Microsoft.UI.Xaml.Controls.SplitButton sender, Microsoft.UI.Xaml.Controls.SplitButtonClickEventArgs args)
        {
            var border = (Border)sender.Content;
            var color  = ((Windows.UI.Xaml.Media.SolidColorBrush)border.Background).Color;

            myRichEditBox.Document.Selection.CharacterFormat.ForegroundColor = color;
            currentColor = color;
        }
Example #4
0
 /// <summary>
 /// 点击拆分按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private async void SitesSplitButton_Click(SplitButton sender, SplitButtonClickEventArgs args)
 {
     if (sender.Content is TextBlock textBlock)
     {
         var uri = textBlock.DataContext as string;
         await Launcher.LaunchUriAsync(new Uri(uri));
     }
 }
Example #5
0
        private async void ColorPicker_Click(Microsoft.UI.Xaml.Controls.SplitButton sender, Microsoft.UI.Xaml.Controls.SplitButtonClickEventArgs args)
        {
            var eyedropper = new Eyedropper();

            eyedropper.ColorChanged  += Eyedropper_ColorChanged;
            eyedropper.PickCompleted += Eyedropper_PickCompleted;
            var color = await eyedropper.Open();
        }
Example #6
0
        public void VerifyFontFamilyForChevron()
        {
            using (StyleHelper.UseFluentStyles())
            {
                var splitButton = new SplitButton();
                TestServices.WindowHelper.WindowContent = splitButton;

                var secondayButton = splitButton.GetTemplateChild("SecondaryButton");
                var font           = ((secondayButton as Button).Content as TextBlock).FontFamily;
                Verify.AreEqual((FontFamily)Application.Current.Resources["SymbolThemeFontFamily"], font);
            }
        }
 private void myListButton_Click(Microsoft.UI.Xaml.Controls.SplitButton sender, Microsoft.UI.Xaml.Controls.SplitButtonClickEventArgs args)
 {
     if ((sender as Microsoft.UI.Xaml.Controls.ToggleSplitButton).IsChecked)
     {
         //add bulleted list
         myRichEditBox.Document.Selection.ParagraphFormat.ListType = _type;
     }
     else
     {
         //remove bulleted list
         myRichEditBox.Document.Selection.ParagraphFormat.ListType = MarkerType.None;
     }
 }