Click here to Skip to main content
15,505,828 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Converting a byte[] to a ImageSource means huge memory leak Pin
Starwer30-Jan-22 6:04
Starwer30-Jan-22 6:04 
GeneralRe: Converting a byte[] to a ImageSource means huge memory leak Pin
Gerry Schmitz30-Jan-22 6:23
mveGerry Schmitz30-Jan-22 6:23 
GeneralRe: Converting a byte[] to a ImageSource means huge memory leak Pin
Starwer30-Jan-22 8:45
Starwer30-Jan-22 8:45 
SuggestionRe: Converting a byte[] to a ImageSource means huge memory leak Pin
Richard Deeming30-Jan-22 22:52
mveRichard Deeming30-Jan-22 22:52 
Question(MahApp) not using style for control Pin
Super Lloyd20-Jan-22 0:07
Super Lloyd20-Jan-22 0:07 
AnswerRe: (MahApp) not using style for control Pin
Super Lloyd20-Jan-22 0:08
Super Lloyd20-Jan-22 0:08 
QuestionMarkupExtension, resource files and visual studio designer Pin
Super Lloyd16-Jan-22 7:40
Super Lloyd16-Jan-22 7:40 
QuestionTextBox Bound To Decimal - Can't Type Decimal Pin
Kevin Marois28-Dec-21 9:29
professionalKevin Marois28-Dec-21 9:29 
I have a TextBox bound to a decimal. I'm using Clifford Nelson's [^] Number Only Behaviour for WPF.

I added a DP to toggle allowing decimals called AllowDecimals, but I've found a problem, andit's NOT with Clifford's code. And it only happens when BOUND to a property.

First, here's the OnTextInput
private static void OnTextInput(object sender, TextCompositionEventArgs e)
{
    bool allowDecimals = GetAllowDecimals((Control)sender);

    if (allowDecimals && e.Text.Any(c => c.Equals('.')))
    {
        // When I type a decimal point, it comes here, but no decimal point appears in the textbox
    }
    else
    {
        if (e.Text.Any(c => !char.IsDigit(c)))
        {
            e.Handled = true;
        }
    }
}
As you can see by the comment, if I turn on AllowDecimals and type a '.', the code hits where it should, but I don't see it in the TextBox.

If I type some digits THEN arrow over in between two digits and type a '.', then it's accepted.

I beleive the problem is that the binding is trying to parse the value and somehow discards or swallows the decimal point.

The WPF ToolKit has a DecimalUpDown control. I don't really want to bring in that entire library just so I can enter a decimal point.

Anyone have a workaround or fix for this?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Mycroft Holmes28-Dec-21 11:05
professionalMycroft Holmes28-Dec-21 11:05 
GeneralRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Kevin Marois28-Dec-21 11:25
professionalKevin Marois28-Dec-21 11:25 
GeneralRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Super Lloyd16-Jan-22 7:45
Super Lloyd16-Jan-22 7:45 
GeneralRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Mycroft Holmes16-Jan-22 11:55
professionalMycroft Holmes16-Jan-22 11:55 
GeneralRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Eddy Vluggen9-Feb-22 3:40
professionalEddy Vluggen9-Feb-22 3:40 
GeneralRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Super Lloyd9-Feb-22 13:10
Super Lloyd9-Feb-22 13:10 
GeneralRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Eddy Vluggen9-Feb-22 13:13
professionalEddy Vluggen9-Feb-22 13:13 
AnswerRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Richard Deeming4-Jan-22 1:04
mveRichard Deeming4-Jan-22 1:04 
QuestionSetting DataGrid Cell Style From Code Behind Pin
Kevin Marois20-Dec-21 11:56
professionalKevin Marois20-Dec-21 11:56 
AnswerRe: Setting DataGrid Cell Style From Code Behind Pin
#realJSOP22-Dec-21 3:06
mva#realJSOP22-Dec-21 3:06 
QuestionInput Question Pin
Super Lloyd19-Dec-21 5:17
Super Lloyd19-Dec-21 5:17 
AnswerRe: Input Question Pin
#realJSOP19-Dec-21 23:26
mva#realJSOP19-Dec-21 23:26 
GeneralRe: Input Question Pin
Super Lloyd20-Dec-21 0:05
Super Lloyd20-Dec-21 0:05 
GeneralRe: Input Question Pin
#realJSOP20-Dec-21 0:18
mva#realJSOP20-Dec-21 0:18 
GeneralRe: Input Question Pin
Super Lloyd20-Dec-21 0:23
Super Lloyd20-Dec-21 0:23 
Question(Advanced?) Layout question Pin
Super Lloyd17-Dec-21 21:02
Super Lloyd17-Dec-21 21:02 
QuestionAbout RichTextBox size in a canvas Pin
Super Lloyd12-Dec-21 2:23
Super Lloyd12-Dec-21 2:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.