Skip to content

Add RichEditBox Math Mode Examples #1813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 70 commits into from
Apr 22, 2025

Conversation

Zakariathr22
Copy link
Contributor

@Zakariathr22 Zakariathr22 commented Mar 22, 2025

Description

This PR adds new examples demonstrating the Math Mode features in RichEditBox.

Motivation and Context

Helping developers understand how to use math mode.

How Has This Been Tested?

Manually tested.

Screenshots (if appropriate):

image
image

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Implemented a new `ControlExample` in `RichEditBoxPage.xaml` for a math mode editor, featuring a `RichEditBox` for input, a `SelectorBar` for symbol selection, and a grid layout for displaying symbols with their properties. Added styles for alternating row backgrounds and set a description for math mode functionality.

Updated `RichEditBoxPage.xaml.cs` to initialize math mode, populate a list of mathematical symbols, and handle symbol insertion. Introduced a new `MathSymbol` class to encapsulate symbol properties.
Introduced `MathModeHelper.cs` with a static class to manage a collection of mathematical symbols as `ObservableCollection<MathSymbol>`, including methods for commands input so symbols can be added where the cursor is stoping. Updated `RichEditBoxPage.xaml` to use the new namespace and modified `RichEditBoxPage.xaml.cs` to utilize `MathModeHelper.GetSymbolsCollection()` for symbol initialization, simplifying the code. The `MathSymbol` class is now encapsulated within `MathModeHelper.cs`.
@Zakariathr22
Copy link
Contributor Author

@niels9001 @marcelwgn @Hemantxk

Before going further with this PR, could you review it? The remaining work is mostly repetitive, and the main ideas are already in place. Do I have the green light to complete it?

@niels9001
Copy link
Contributor

@niels9001 @marcelwgn @Hemantxk

Before going further with this PR, could you review it? The remaining work is mostly repetitive, and the main ideas are already in place. Do I have the green light to complete it?

I think it looks great :)! Please go ahead!

@Saharsh979
Copy link

/azp run

@Hemantxk
Copy link

Thank you! Really appreciate the efforts you put into checking in these examples. Can you also attach few more screenshots of the new sections from different pages? Structures/Integrals/Accent etc.

@Zakariathr22 Zakariathr22 requested a review from Saharsh979 April 8, 2025 19:43
@Saharsh979
Copy link

/azp run

@marcelwgn
Copy link
Contributor

marcelwgn commented Apr 10, 2025

Thank you for making this PR @Zakariathr22 and sorry for not getting back to it earlier. Besides the table discussion (on which I will get back to you next week) and whether to include it or not, I think it is good as is 😊

P.S. I understand the choice for using one of the most famous equations in the world to highlight the feature though as a math nerd I would have loved to see something out of ZFC or similar (no need to change this though)

@marcelwgn
Copy link
Contributor

Thank you @Zakariathr22 for your continuously keeping this PR up to date! As of right now, I think the best direction right now would be to not include the table of symbols due to its complexity. Otherwise the PR looks good to me 😊

@Zakariathr22
Copy link
Contributor Author

Thank you @Zakariathr22 for your continuously keeping this PR up to date! As of right now, I think the best direction right now would be to not include the table of symbols due to its complexity. Otherwise the PR looks good to me 😊

@marcelwgn Just to clarify, did you mean removing just this table, or the entire section (symbols and structures)?
image

@marcelwgn
Copy link
Contributor

I think we should keep the samples but get rid of the tables altogether. I know you worked hard on this and you did an excellent job so I am sorry we are taking this turn but I think right now this is the best direction for these samples.

@Zakariathr22
Copy link
Contributor Author

I think we should keep the samples but get rid of the tables altogether. I know you worked hard on this and you did an excellent job so I am sorry we are taking this turn but I think right now this is the best direction for these samples.

I think GitHub should really add a 💔 reaction for moments like this 😄
Just wish the decision came a bit earlier before I fixed this 😂

When pasting a character in using the button below the sample showcases, the keyboard layout of my OS changes, this should definitely not happen.

But to be fair, your suggestion makes sense and I’ll go with it 👍

Zakariathr22 and others added 3 commits April 19, 2025 18:35
Copy link
Contributor

@marcelwgn marcelwgn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making this contribution and keeping this PR continously up to date!

@marcelwgn
Copy link
Contributor

/azp run

@marcelwgn marcelwgn enabled auto-merge (squash) April 22, 2025 12:48
@marcelwgn marcelwgn merged commit be0c565 into microsoft:main Apr 22, 2025
2 checks passed
@niels9001 niels9001 deleted the feature/richedit-math-mode branch April 22, 2025 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants