Skip to content
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

NumericUpDown control support decimals value, and the value for each increase or decrease can be set. #3661

Merged
merged 6 commits into from
Nov 7, 2024

Conversation

futuresBoy
Copy link
Contributor

NumericUpDown control support int and decimals value, and the value for each increase or decrease can be set.

@Keboo
Copy link
Member

Keboo commented Aug 29, 2024

I am hesitant to change all of the types from int to decimal as that would be a breaking change for everyone currently using it.

I would propose the following alternate solution:

  1. Create a new abstract UpDownBase<T> class. Most of the code could move into this base class with abstract members where needed.
  2. Create a new DependencyProperty for ValueStep to represent the amount to be incremented or decremented.
  3. Make the NumericUpDown derive from UpDownBase<int>
  4. Create a new DecimalUpDown class and derive from UpDownBase<decimal>
  5. Create a new implicit style for DecimalUpDown and have it based on the NumericUpDown style.

Thoughts?

@futuresBoy
Copy link
Contributor Author

I got your proposal. I will create a new DecimalUpDown base on NumericUpDown

@futuresBoy
Copy link
Contributor Author

Follow your proposal, I made the following changes:

  1. Create a new abstract UpDownBase<T> class. 'NumericUpDown ' code move into this base class.
  2. Besides, need define an interface 'IArithmetic ' to abstract the operation of the T-value between int and decimal and other Type.
  3. Create a new DependencyProperty for ValueStep to represent the amount to be incremented or decremented.
  4. Make the NumericUpDown derive from UpDownBase<int> and 'IArithmetic'
  5. Create a new DecimalUpDown class and derive from UpDownBase<decimal> and 'IArithmetic'
  6. Change TargetType 'NumericUpDown' to 'UpDownBase', so the 'NumericUpDown ' and 'DecimalUpDown ' share the same style.

And in this way, it does't affect everyone who are using 'NumericUpDown' currently.

TODO: Need to fix XAMLTest to support the common generic base class so the generator stops choking
@Keboo
Copy link
Member

Keboo commented Sep 5, 2024

@futuresBoy this is great work. I spent some time on my like stream doing some updates to leverage the new generic math on .NET8.

There is an issue with my testing library (XAMLTest) that I want to address then we can get this merged.

Keboo added a commit to Keboo/XAMLTest that referenced this pull request Oct 31, 2024
Keboo added a commit to Keboo/XAMLTest that referenced this pull request Oct 31, 2024
Copy link
Contributor

github-actions bot commented Nov 5, 2024

This PR is marked stale because it has been open 60 days with no activity. Remove stale label or update the PR, otherwise it will be closed in 14 days.

@github-actions github-actions bot added the Stale Issues and PRs that have not had activity for a while are marked with this label. label Nov 5, 2024
@Keboo Keboo removed the Stale Issues and PRs that have not had activity for a while are marked with this label. label Nov 7, 2024
@Keboo Keboo enabled auto-merge (squash) November 7, 2024 06:02
@Keboo Keboo added this to the 5.2.0 milestone Nov 7, 2024
@Keboo Keboo added release notes Items are likely to be highlighted in the release notes. enhancement labels Nov 7, 2024
@Keboo Keboo disabled auto-merge November 7, 2024 06:03
Updated new XAMLTest library
Added DeciamlUpDown tests
@Keboo Keboo enabled auto-merge (squash) November 7, 2024 06:10
@Keboo Keboo merged commit 94f2177 into MaterialDesignInXAML:master Nov 7, 2024
2 checks passed
JLdgu pushed a commit to JLdgu/MaterialDesignInXamlToolkit that referenced this pull request Nov 8, 2024
…increase or decrease can be set. (MaterialDesignInXAML#3661)

* Support decimals value, and the size of value for each increase or decrease can be set.

* UpDown control support decimals, and the value for each increase or decrease can be set.

* Updates to UpDownBase to support generic math on NET8

TODO: Need to fix XAMLTest to support the common generic base class so the generator stops choking

* Updating UI tests

Updated new XAMLTest library
Added DeciamlUpDown tests

---------

Co-authored-by: Kevin Bost <kevin@intellitect.com>
Co-authored-by: Kevin Bost <kitokeboo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement release notes Items are likely to be highlighted in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants