Skip to content

Commit

Permalink
chore: Adjust for RichEditBox
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Nov 17, 2022
1 parent 972111e commit 0dcbb8d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void OnExtraCommandBarFlyoutTestsClicked(object sender, object args)
}
private void CmbCommandBarFlyoutOutputDebugStringLevel_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
#if HAS_UNO
#if false
MUXControlsTestHooks.SetOutputDebugStringLevelForType(
"CommandBarFlyout",
cmbCommandBarFlyoutOutputDebugStringLevel.SelectedIndex == 1 || cmbCommandBarFlyoutOutputDebugStringLevel.SelectedIndex == 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
<AppBarToggleButton x:Name="FavoriteToggleButton9" AutomationProperties.AutomationId="FavoriteToggleButton9" Label="Favorite" Icon="Favorite" Checked="OnElementChecked" Unchecked="OnElementUnchecked" />
</muxc:CommandBarFlyout.SecondaryCommands>
</muxc:CommandBarFlyout>
<contract13Present:CommandBarFlyout Placement="Right" x:Name="Flyout10" AutomationProperties.AutomationId="Flyout10" Opened="OnFlyoutOpened" Closed="OnFlyoutClosed">
<!--<contract13Present:CommandBarFlyout Placement="Right" x:Name="Flyout10" AutomationProperties.AutomationId="Flyout10" Opened="OnFlyoutOpened" Closed="OnFlyoutClosed">
<AppBarButton x:Name="CutButton10" AutomationProperties.AutomationId="CutButton10" Label="Cut" Icon="Cut" Click="OnElementClicked" />
<AppBarButton x:Name="CopyButton10" AutomationProperties.AutomationId="CopyButton10" Label="Copy" Icon="Copy" Click="OnElementClicked" />
<AppBarButton x:Name="PasteButton10" AutomationProperties.AutomationId="PasteButton10" Label="Paste" Icon="Paste" Click="OnElementClicked" />
Expand All @@ -214,7 +214,7 @@
<AppBarButton x:Name="SelectAllButton10" AutomationProperties.AutomationId="SelectAllButton10" Label="Select all" Click="OnElementClicked" />
<AppBarToggleButton x:Name="FavoriteToggleButton10" AutomationProperties.AutomationId="FavoriteToggleButton10" Label="Favorite" Icon="Favorite" Checked="OnElementChecked" Unchecked="OnElementUnchecked" />
</contract13Present:CommandBarFlyout.SecondaryCommands>
</contract13Present:CommandBarFlyout>
</contract13Present:CommandBarFlyout>-->
</Grid.Resources>
<ScrollViewer>
<StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</Grid.ColumnDefinitions>
<TextBox x:Name="TextBox1" AutomationProperties.AutomationId="TextBox" Text="Lorem ipsum ergo sum" Margin="10" />
<TextBlock x:Name="TextBlock1" AutomationProperties.AutomationId="TextBlock" Text="Lorem ipsum ergo sum" Margin="10" IsTextSelectionEnabled="True" Grid.Row="1" />
<RichEditBox x:Name="RichEditBox1" AutomationProperties.AutomationId="RichEditBox" Margin="10" Grid.Row="2" />
<!--<RichEditBox x:Name="RichEditBox1" AutomationProperties.AutomationId="RichEditBox" Margin="10" Grid.Row="2" />-->
<RichTextBlock x:Name="RichTextBlock1" AutomationProperties.AutomationId="RichTextBlock" Margin="10" IsTextSelectionEnabled="True" Grid.Row="3">
<Paragraph>
<Bold>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ public TextCommandBarFlyoutPage()
{
this.InitializeComponent();

RichEditBox1.Document.SetText(Windows.UI.Text.TextSetOptions.None, "Lorem ipsum ergo sum");
Clipboard.ContentChanged += OnClipboardContentChanged;
#if !HAS_UNO
RichEditBox1.Document.SetText(Windows.UI.Text.TextSetOptions.None, "Lorem ipsum ergo sum");
#endif
Clipboard.ContentChanged += OnClipboardContentChanged;

if (ApiInformation.IsEnumNamedValuePresent("Windows.UI.Xaml.Controls.Primitives.FlyoutPlacementMode", "BottomEdgeAlignedLeft"))
{
Expand All @@ -52,8 +54,10 @@ public TextCommandBarFlyoutPage()
{
TextBox1.ContextFlyout = TextControlContextFlyout;
TextBlock1.ContextFlyout = TextControlContextFlyout;
RichEditBox1.ContextFlyout = TextControlContextFlyout;
RichTextBlock1.ContextFlyout = TextControlContextFlyout;
#if !HAS_UNO
RichEditBox1.ContextFlyout = TextControlContextFlyout;
#endif
RichTextBlock1.ContextFlyout = TextControlContextFlyout;
PasswordBox1.ContextFlyout = TextControlContextFlyout;
}

Expand All @@ -71,8 +75,10 @@ public TextCommandBarFlyoutPage()

if (ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Controls.RichEditBox", "SelectionFlyout"))
{
RichEditBox1.SelectionFlyout = TextControlSelectionFlyout;
}
#if !HAS_UNO
RichEditBox1.SelectionFlyout = TextControlSelectionFlyout;
#endif
}

if (ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Controls.RichTextBlock", "SelectionFlyout"))
{
Expand Down Expand Up @@ -135,8 +141,10 @@ private void OnTextBlockSelectAllClicked(object sender, object args)

private void OnRichEditBoxSelectAllClicked(object sender, object args)
{
RichEditBox1.Document.Selection.Expand(Windows.UI.Text.TextRangeUnit.Story);
}
#if !HAS_UNO
RichEditBox1.Document.Selection.Expand(Windows.UI.Text.TextRangeUnit.Story);
#endif
}

private void OnRichTextBlockSelectAllClicked(object sender, object args)
{
Expand All @@ -155,8 +163,10 @@ private void OnTextBlockClearSelectionClicked(object sender, object args)

private void OnRichEditBoxClearSelectionClicked(object sender, object args)
{
RichEditBox1.Document.Selection.Collapse(true);
}
#if !HAS_UNO
RichEditBox1.Document.Selection.Collapse(true);
#endif
}

private void OnTextBoxFillWithTextClicked(object sender, object args)
{
Expand All @@ -165,8 +175,10 @@ private void OnTextBoxFillWithTextClicked(object sender, object args)

private void OnRichEditBoxFillWithTextClicked(object sender, object args)
{
#if !HAS_UNO
RichEditBox1.Document.SetText(TextSetOptions.None, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
}
#endif
}

private void OnRichTextBlockClearSelectionClicked(object sender, object args)
{
Expand All @@ -185,8 +197,10 @@ private void OnShowTextControlFlyoutOnTextBlockClicked(object sender, object arg

private void OnShowTextControlFlyoutOnRichEditBoxClicked(object sender, object args)
{
ShowTextControlContextFlyoutTransient(RichEditBox1);
}
#if !HAS_UNO
ShowTextControlContextFlyoutTransient(RichEditBox1);
#endif
}

private void OnShowTextControlFlyoutOnRichTextBlockClicked(object sender, object args)
{
Expand All @@ -210,8 +224,10 @@ private void OnShowStandardTextControlFlyoutOnTextBlockClicked(object sender, ob

private void OnShowStandardTextControlFlyoutOnRichEditBoxClicked(object sender, object args)
{
ShowTextControlContextFlyoutStandard(RichEditBox1);
}
#if !HAS_UNO
ShowTextControlContextFlyoutStandard(RichEditBox1);
#endif
}

private void OnShowStandardTextControlFlyoutOnRichTextBlockClicked(object sender, object args)
{
Expand Down Expand Up @@ -264,9 +280,11 @@ private void OnSetClipboardContentsClicked(object sender, object args)

private void OnGetRichEditBoxRtfContentClicked(object sender, object args)
{
string rtfContent;
#if !HAS_UNO
string rtfContent;
RichEditBox1.Document.GetText(TextGetOptions.FormatRtf, out rtfContent);
StatusReportingTextBox.Text = rtfContent;
}
StatusReportingTextBox.Text = rtfContent;
#endif
}
}
}

0 comments on commit 0dcbb8d

Please sign in to comment.