Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion WinUIGallery/Samples/ControlPages/SplitButtonPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
MinHeight="0"
Padding="5"
VerticalAlignment="Top"
AutomationProperties.Name="Font color with text">
AutomationProperties.Name="Font color with text"
Click="myColorButtonReveal_Click">
Choose color
<SplitButton.Flyout>
<Flyout Placement="Bottom">
Expand Down
7 changes: 7 additions & 0 deletions WinUIGallery/Samples/ControlPages/SplitButtonPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,20 @@ private void RevealColorButton_Click(object sender, RoutedEventArgs e)
myColorButtonReveal.Flyout.Hide();
}

private void myColorButtonReveal_Click(SplitButton sender, SplitButtonClickEventArgs args)
{
sender.Flyout.ShowAt(sender);
}

private void myColorButton_Click(Microsoft.UI.Xaml.Controls.SplitButton sender, Microsoft.UI.Xaml.Controls.SplitButtonClickEventArgs args)
{
var border = (Border)sender.Content;
var color = ((Microsoft.UI.Xaml.Media.SolidColorBrush)border.Background).Color;

myRichEditBox.Document.Selection.CharacterFormat.ForegroundColor = color;
currentColor = color;

sender.Flyout.ShowAt(sender);
}

private void MyRichEditBox_TextChanged(object sender, RoutedEventArgs e)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<SplitButton x:Name="myColorButton">
<SplitButton x:Name="myColorButton" Click="myColorButton_Click">
Choose color
<SplitButton.Flyout>
<Flyout Placement="Bottom">
Expand Down