Home Forums WPF controls Xceed DataGrid for WPF Getting rid of MaskedTextBox underlines

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #26568 |

    I am using a a masked text box to display a percent value

    <DataTemplate x:Key=”percentCellDataTemplate”>
    <xcdg:MaskedTextBox Value=”{xcdg:CellEditorBinding}”
    IncludeLiteralsInValue=”False”
    ValueDataType=”{x:Type s:Decimal}”
    Mask=”### %”
    Background=”Transparent”
    Focusable=”false”
    BorderThickness=”0″
    QueryTextFromValue=”Mask_QueryTextFromValue”/>
    </DataTemplate>

    I get underlines in the blank spaces. For example “5 %” displays as “__5 %”

    is there anyway I can get rid of the underlines when this value is displayed?

    Thank you.

    Imported from legacy forums. Posted by Ben (had 3148 views)

    Xceed Support
    Member
    Post count: 5658

    Change the PromptChar property to the value you want.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 3171 views)

    User (Old forums)
    Member
    Post count: 23064

    hi,

    the problem is if i set the PromptChar=”” to empty, then the quadrat character is shown and the entered text with the quadrats is saved to the bound DataTable as well.

    how can i  avoid this behaviour?

     thanks, k.

     

     

    Imported from legacy forums. Posted by noname (had 1669 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi,

    I guess that what Jenny meant was to set the PromptChar to a ‘ ‘ (a space).

    However, a much better way to achieve what you want would be to simply set the MaskedTextBox’ HidePromptOnLeave property to True.

     

    Regards,

    Imported from legacy forums. Posted by PL (had 866 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks, the HidePromptOnLeave works if i leave the editor before saving the DataTable.

    if i press enter while i am in editing mode of the maskedtextbox, then the table is saved (rowchanged event of the datatable) before the editor has been left and the prompt is saved as well – same problem.

    can i somehow force to leave the maskedtextbox editor before rowchanged is called?

     thanks, k.

     

     

     

     

    Imported from legacy forums. Posted by noname (had 673 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi,

    There is no  way I can think of to force the MaskedTextBox to lose keyboard focus earlier.

    I noticed that  you set your MaskedTextBox ValueDataType to Decimal… is your underlying DataTable using a Decimal column ?  If so, you could bind the Value property of MaskedTextBox instead of Text.

    If that’s not the case, and for some reason you are storing the percent value as a string, then another possible solution might be to set the ValueDataType to String and use the QueryValueFromText event to set the value to the unmasked text.  

    You can format the maskedText as you want by using the MaskedTextBox MaskedTextProvider property.  This returns the Microsoft’s MaskedTextProvider mask engine on which you can call one of the many overloads of ToString to obtain the masked or unmasked string formatted as you like.

     

    Regards, 

    Imported from legacy forums. Posted by PL (had 1831 views)

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.