leocb / MaterialSkin

Theming .NET WinForms, C# or VB.Net, to Google's Material Design Principles.
MIT License
438 stars 132 forks source link

Multiline TextBox Issue when typing #213

Closed valimaties closed 2 years ago

valimaties commented 3 years ago

Hi. It's happening only to me or this is how it is working this control?! When I press a key the caret position go to beginning (first position in control). I don't have any event in KeyDown, KeyPress, or anywhere else...

orapps44 commented 3 years ago

Hi, I can't reproduce this behaviour. Which release are you using ?

valimaties commented 2 years ago

I use the latest release I found on nuget (v2.2.1).

I made a test form and seems it works correctly. But I found the problem. All my controls has DataBinding on form properties. This makes control behaves unproperly.

this is my code:

public string _foreignName_Item;
public string ForeignName_Item 
{ 
    get => _foreignName_Item; 
    set 
    { 
        _foreignName_Item = value; 
        NotifyPropertyChanged(nameof(ForeignName_Item)); 
    } 
}

 mtxtForeignName.DataBindings.Add("Text", this, nameof(ForeignName_Item), false, DataSourceUpdateMode.OnPropertyChanged);

Do I have a solution for this?

valimaties commented 2 years ago

Solved: Changed DataSourceUpdateMode to OnValidation instead of OnPropertyChanged! This thread helped me!