HandyOrg / HandyOrg/HandyControl

SearchBar does not work with DataBinding (MVVM)

Open
#946 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
7.2k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Hello,
At first I'd like to say this is my first issue I create here. Also I'm really impressed by all the work you did to provide developers with all this amazing controls.

My problem is that I cannot use SearchBar with MVVM, in particular IsError and ErrorStr properties.
When I bind to above mentioned properties there is no effect on the control. This is because internal code in TextBox.cs in VerifyData() overrides these properties based on default validation code, when no VerifyFunction has been provided.

If I were to provide VerifyFunction this has to return OperationResult<bool> which is technology-specific and therefore should not be used within ViewModel. What's worse I cannot event bind any function to VerifyFunction because this is not a DependencyProperty !

The only thing I can do now is to provide a VerifyFunction implementation in code-behind of my view object and from there I need to call a ViewModel by explicit casting it from DataContex to fetch logic for validation.

Please feel free to ask if anything is unclear or you need more details on this problem.
I think the SearchBar control is great, it just need a small improvement to fully support MVVM architecutre.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in TextBox.cs at VerifyData() and trace how SearchBar handles the IsError and ErrorStr properties when no VerifyFunction is supplied. Compare that behavior with MVVM binding expectations; done means those bound properties can control validation without requiring a code-behind VerifyFunction or explicit ViewModel casting.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.