Hello,
First thanks for this awesome project.
I don't know if this is the right place to ask for a feature, if not, please redirect me to the correct place.
Is there any plans for a maked textbox, or an attached property for this efect?
Thanks,
Frederico
you can make it with
<PasswordBox x:Name="passwordBox" PasswordChar="*" />
Hello,
PasswordBox is a different control for a specific scenario.
The type of control i'm talking is like:
http://wpftoolkit.codeplex.com/wikipage?title=MaskedTextBox&referringTitle=Home
Thanks,
Frederico
I would love this feature too!
I'll start working on it.
@petvetbr I have already a solution in pipeline, so please wait until i published is via PR, so you can just look if it's the solution you also think it's good
@punker76 sure, no problem, I'll wait. I was offering to belo because I saw the issue was not assigned. I'll look at another issue.
A recommendation to make it 100x easier than the WPF Toolkit maskedtextbox is to intelligently handle cursor position.
As an example, lets assume the mask is for a US phone number: (___) ___-____
If the user didn't enter in any data, then the cursor should be placed immediately after the ( when the control gets focus.
If the control does have data, like this: (345) 12_-____
and the user clicks anywhere after the 2, then the cursor should be forced to go immediately after the 2. If the user clicks anywhere before the 2, then the cursor should just go to where they clicked.
If the control gets focus through something other than a mouse click, cursor position should be after the 2.
Hope this makes sense. It would make for a better UI for things like phone numbers, social security numbers, etc.
Since not everyone will want this functionality, perhaps have it turned on with a bool property?
You can also use the Extended WPF Toolkit MaskedTextBox and simply apply the MetroTextBox Style to it. You just add the MahApps.Metro TextBox resource dictionary to your App.xaml MargedDictionaries and then you can add a Style "BasedOn" MetroTextBox with the MaskedTextBox TargetType as shown below:
<Application ...
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
...>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.TextBox.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource MetroTextBox}" TargetType="{x:Type xctk:MaskedTextBox}" />
</ResourceDictionary>
</Application.Resources>
...
</Application>
It's also possible to do this with a behavior like TextBoxInputMaskBehavior
Most helpful comment
A recommendation to make it 100x easier than the WPF Toolkit maskedtextbox is to intelligently handle cursor position.
As an example, lets assume the mask is for a US phone number: (___) ___-____
If the user didn't enter in any data, then the cursor should be placed immediately after the ( when the control gets focus.
If the control does have data, like this: (345) 12_-____
and the user clicks anywhere after the 2, then the cursor should be forced to go immediately after the 2. If the user clicks anywhere before the 2, then the cursor should just go to where they clicked.
If the control gets focus through something other than a mouse click, cursor position should be after the 2.
Hope this makes sense. It would make for a better UI for things like phone numbers, social security numbers, etc.
Since not everyone will want this functionality, perhaps have it turned on with a bool property?