Comments (14)
Interesting. If you disable CompiledBindings for a test, does it disappear?
from avalonia.
After adding this to my project file, the result is the same.
<AvaloniaUseCompiledBindingsByDefault>false</AvaloniaUseCompiledBindingsByDefault>
MaskedTextBox
has not changed very much, so it is doing what it has always done, which is to refresh the Text property in the OnTextInput
OnKeyDown
and OnPropertyChanged
events. If I comment out line 443 in MaskedTextBox.cs, the problem goes away, but of course then the control displays nothing:
SetCurrentValue(TextProperty, provider.ToDisplayString());
The Binding System went though a major refactor (#13970), so I assume that the issue was introduced there. The initial Text
value is being set to null, the OnPropertyChanged
event fires, causing a refresh to the Text
property (again), and the cycle seems to repeat.
The docs say the SetCurrentValue
method is supposed to be used for programmatically setting a bound property, so it makes sense that is the method called during the events.
from avalonia.
This issue caught my eye, but it did not help to test without the changes. I thought I'd mention it here anyway.
Make bindings react to PropertyChanged even if property hasn't changed #16150
from avalonia.
Thanks for testing. I also end up in an infinite cycle with another 3rd party control and can't wrap my head around. So if it was compiled bindings extension, that would have been a good entry point. I'm also certain it has to do with the bindings refractor somehow.
/cc @grokys will try to see if I can mange to get this into Sandbox to narrow it down as this is also bugging me ^^
from avalonia.
@busitech I can't reproduce this with a simple sample :-( Can you provide a minimal sample for me to test?
My ViewModel:
public partial class MainViewModel: ObservableObject
{
[ObservableProperty] private string? _name;
}
My MainView:
<MaskedTextBox Text="{Binding Name}" Mask="???" />
from avalonia.
Yes, here is my test project.
from avalonia.
Hello @timunie, were you able to reproduce with my sample?
from avalonia.
Another side effect of the binding system changes is that the source property of the Binding on the Text property of the MaskedTextBox is being set to the masked value, even before any user input has been made in the control.
At 11.0.13, no changes would be made to the source property until user input occurs. This would be the correct behavior.
from avalonia.
One input necessary to reproduce this issue is to bind the Text property on the MaskedTextBox to an initial value that does not conform to the mask (including null or empty string).
from avalonia.
Hello @timunie, were you able to reproduce with my sample?
Guess what? I was able to reproduce it with your sample attached. I added the relevant parts to Sandbox, and the issue was gone. Can't wrap my head around it yet 🤷
from avalonia.
I am reproducing with the nightly build 11.2.999-cibuild0051406-alpha, and with my sample directly inside the Avalonia project, using the latest commit.
I produced a patch today that takes care of the writing back of the value during the initial subscription, and that took care of the cycle.
from avalonia.
This is a very simple approach to preventing the stack overflow, by preventing the write-back of the value to the source during publish.
from avalonia.
👍 could you make a PR of that patch?
- Helps to run unit tests
- easier for the team to feedback and double-check
from avalonia.
Today I made a new patch I am more pleased with. It will be the basis of my PR.
from avalonia.
Related Issues (20)
- Break point can not be hit when any ResourceDictionary exceeds 8192 lines HOT 3
- The Placeholder Disappears when Setting DisplayMemberBinding on ComboBox
- AttachedToVisualTree or Loaded on UserControl gives Invalid Markup HOT 1
- Constantly High CPU usage on Win10 14393
- CheckBox fluent theme ControlTheme selectors should target control Background and BorderBrush properties instead Border#PART_Border
- 11.2.0-beta1 - XAML compiler error when using binding in style setter HOT 1
- Wrong base class in axaml code-behind causes internal compiler error in xaml compiler HOT 4
- KeyPreview for Window handles Keys before i can can set Handled
- Scrolling ComboBox items affects parent ScrollViewer
- Setting up Design Time DataContext in Xaml causes Invalid Markup Error HOT 1
- RelativePanel contains the wrong implementation
- nuke on macOS build error CS0017: Program has more than one entry point defined. HOT 2
- Issue with BinaryReader.ReadString returning wrong value on combo WASM+AndroidDevice(not simulator)+Chrome+AOT
- [11.2.0-beta1] this.Target.Opacity doesn't work as expected in Vector3KeyFrameAnimation
- Arrange control to a smaller Rect can't shrink the size of control HOT 1
- Avalonia sometimes discards the DispatcherOperation with Input or lower priority HOT 4
- MinWidth not applied on UserControl HOT 1
- Custom font crash on Linux with 'Could not create glyphTypeface'. Works under Windows HOT 2
- Crash when tooltip overlaps mouse cursor during drag operation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avalonia.