Click here to Skip to main content
15,311,717 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Converting a byte[] to a ImageSource means huge memory leak Pin
Starwer30-Jan-22 5:04
MemberStarwer30-Jan-22 5:04 
GeneralRe: Converting a byte[] to a ImageSource means huge memory leak Pin
Gerry Schmitz30-Jan-22 5:23
mveGerry Schmitz30-Jan-22 5:23 
GeneralRe: Converting a byte[] to a ImageSource means huge memory leak Pin
Starwer30-Jan-22 7:45
MemberStarwer30-Jan-22 7:45 
SuggestionRe: Converting a byte[] to a ImageSource means huge memory leak Pin
Richard Deeming30-Jan-22 21:52
mveRichard Deeming30-Jan-22 21:52 
Question(MahApp) not using style for control Pin
Super Lloyd19-Jan-22 23:07
MemberSuper Lloyd19-Jan-22 23:07 
AnswerRe: (MahApp) not using style for control Pin
Super Lloyd19-Jan-22 23:08
MemberSuper Lloyd19-Jan-22 23:08 
QuestionMarkupExtension, resource files and visual studio designer Pin
Super Lloyd16-Jan-22 6:40
MemberSuper Lloyd16-Jan-22 6:40 
QuestionTextBox Bound To Decimal - Can't Type Decimal Pin
Kevin Marois28-Dec-21 8:29
professionalKevin Marois28-Dec-21 8: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 10:05
professionalMycroft Holmes28-Dec-21 10:05 
GeneralRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Kevin Marois28-Dec-21 10:25
professionalKevin Marois28-Dec-21 10:25 
GeneralRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Super Lloyd16-Jan-22 6:45
MemberSuper Lloyd16-Jan-22 6:45 
GeneralRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Mycroft Holmes16-Jan-22 10:55
professionalMycroft Holmes16-Jan-22 10:55 
GeneralRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Eddy Vluggen9-Feb-22 2:40
professionalEddy Vluggen9-Feb-22 2:40 
GeneralRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Super Lloyd9-Feb-22 12:10
MemberSuper Lloyd9-Feb-22 12:10 
GeneralRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Eddy Vluggen9-Feb-22 12:13
professionalEddy Vluggen9-Feb-22 12:13 
AnswerRe: TextBox Bound To Decimal - Can't Type Decimal Pin
Richard Deeming4-Jan-22 0:04
mveRichard Deeming4-Jan-22 0:04 
QuestionSetting DataGrid Cell Style From Code Behind Pin
Kevin Marois20-Dec-21 10:56
professionalKevin Marois20-Dec-21 10:56 
AnswerRe: Setting DataGrid Cell Style From Code Behind Pin
#realJSOP22-Dec-21 2:06
mva#realJSOP22-Dec-21 2:06 
QuestionInput Question Pin
Super Lloyd19-Dec-21 4:17
MemberSuper Lloyd19-Dec-21 4:17 
AnswerRe: Input Question Pin
#realJSOP19-Dec-21 22:26
mva#realJSOP19-Dec-21 22:26 
GeneralRe: Input Question Pin
Super Lloyd19-Dec-21 23:05
MemberSuper Lloyd19-Dec-21 23:05 
GeneralRe: Input Question Pin
#realJSOP19-Dec-21 23:18
mva#realJSOP19-Dec-21 23:18 
GeneralRe: Input Question Pin
Super Lloyd19-Dec-21 23:23
MemberSuper Lloyd19-Dec-21 23:23 
Question(Advanced?) Layout question Pin
Super Lloyd17-Dec-21 20:02
MemberSuper Lloyd17-Dec-21 20:02 
QuestionAbout RichTextBox size in a canvas Pin
Super Lloyd12-Dec-21 1:23
MemberSuper Lloyd12-Dec-21 1: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.