I am using .net framework 4.5
I have a WPF project, and I use WPF combobox. The property IsEditable is set to true to allow input values.
But when I input non English character such as "â" (I have to type "aa" to make "â", it becomes "aâ".
When I set property IsTextSearchEnabled = "False", "aa" becomes "â" (This is correct behavior).
Does anyone have solution for this when set IsTextSearchEnabled = "True" for WPF combo box?
Firstly, I don't get this behaviour when I type into a ComboBox. If you have something particular about your ComboBox or your computer that gives you this behaviour, you need to share it with us, so that we can better help you.
All the same, I don't know about typing "aa" to make "â", but I do know that if you press 0226 while holding the Alt key down, it will also give you "â". Maybe you could try using that instead?
You can find out more accent codes from the Windows - Alt Key Numeric Codes page on the PennState University website.
Related
Bear with me. I have a ComboBox (WPF) in 'autocomplete' mode.
Easy peasy right? Just set IsEditable to true.
<ComboBox
IsEditable="True"
Text="{Binding Model.TextEntered}"
ItemsSource="{Binding Model.ListWithOptions}"/>
I've got my ComboBox and it autocomplete's just perfect.
BUT when I enter the following text 'caaaaa' it changes it to 'CAaaaa'. I understand the ComboBox autocomplete's the text and match the casing. But when I want to enter caaaaa (for whatever reason) I don't want 'CAaaaa'.
Any idea to solve this?
As an alternative I would settle for (if all else fails):
When leaving the control, check if entered text doesn't match any of the options set text tolower. (as a behaviour)
Have you tried setting ShouldPreserveUserEnteredPrefix="True"? This will not alter the case that is typed into the Combobox but will still match items in the list. So in your example if you type 'ca13' it will find and select 'CA132S', but it will be displayed in the combobox as 'ca132s' (in the case that it was typed in).
A compromise in the way that the item is displayed perhaps, but it will select the correct item and allow you to type characters in either case without alteration.
Try setting IsTextSearchCaseSensitive proprty to true for the ComboBox. Not sure if this property is available in older versions of .NET
Couldn't you use an if statement to check if it matches anything in the list and if it doesn't, don't change it? Like check after each letter entered and if it then doesn't match change it back to the case that was originally entered?
Or is there a reason you want people to be able to type in something that isn't in the list? If not, couldn't you use IsTextSearchEnabled rather than IsEditable?
I am new in silverlight ,I have more than two textbox in a UI, what i want to do is there will be a textbox with a label secondary name,on that text box when user type anything it should come in arabic language!
I mean when users focused on a textbox control the default language need to change to arabic.
I have seen same questions in this stackoverklow,but the answer i saw was saying how to do resource switching of languages of labels,buttons etc. but my question is how can i change the language when i type in a textbox control,Hope u get my point.
Thank you in advance.
You can do this through an API call if you're trying to put the translated text into the label. This link shows example code on how to use the Bing Translation API in Silverlight.
I experience strange things when setting the "Language" property in WPF:
Set FlowDirection to "RightToLeft" on a Window or textbox/textblock
Set the Language property to "fa-IR"
Set the text to one of the sample texts below (A, B)
A. This text does not render correctly in WPF 3.5:
فاکس: +44 1908 215040
It works with WinForms and Silverlight. Note that it contains a 'LEFT-TO-RIGHT MARK' (U+200E)
Here is a HTML version of the above with numeric character references to LRM, to visualize where the LRM is inserted:
فاکس: +44 1908 215040
B. This text does render correctly in WPF:
فاکس: +44 1908 210210
But it contains (I believe) unncessary LRM characters. I put together the text in a trial-and-error fashion.
Here is the HTML version with the extra LRM characters
فاکس: +44 1908 215040
Why are the extra characters needed / what am I doing wrong with the original text?
Note: The problem occurs IFF setting the Language property, either explicitly in XAML or code (like Language="fa-IR") or by overriding the default value of the Language property in code (assuming current culture being "fa-IR") as so:
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement),
new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
If I leave the language property as en-US, the text renders correctly in WPF, but I really need to set the Language to have value conversions work without having to set the ConverterCulture explicitly on each and every data binding that could be binding to some culture dependent data.
There are also other problems, like LRO ('LEFT-TO-RIGHT OVERRIDE' (U+202D)) being ignored.
I really need help understanding what is going on, as this could turn out to be a show stopper for localizing my application to Persian and Arabic.
I suspect that I am the one doing something wrong, as I fail to google for the problem.
Here is a a related post on MS Connect, but no one has so far confirmed the behaviour as a bug:
http://connect.microsoft.com/WPF/feedback/details/682784/incorrect-unicode-bidi-behaviour#
Note: I am not that familiar with the BiDi algorithm in general and know even less of the actual implementation in WPF. I have a basic understanding of Unicode.
I'm developing an application with the official WPF Ribbon system, and I'd like to have a password field up in the ribbon. Is there any way I can modify the RibbonTextBox control to display dots instead of characters, the way a PasswordBox does? Thanks in advance.
Can't you just use the key up event, and take the value out of the box, store it in a variable, and replace it with the character you want?
User presses "A" on key up, you grab the value, store it in a variable, and then replace it with an "*". Keep doing this until they stop typing in the box?
I cannot seem to figure out how to do a Selection Alignment in the new RichTextBox, I have an idea that I need to convert the selection into the Paragraph type which supports alignment, but cannot seem to figure this out. None of the Silverlight examples have this, but I'm sure it is possible.
I have this code, that does not work - as I think I need the selection to be a Paragraph as it always returns and Exception "Value does not fall within the expected range".
Editor.Selection.SetPropertyValue(Paragraph.TextAlignmentProperty, TextAlignment.Left)
I make sure I check for a Valid Selection first, code like the following works for "Bold":
If Editor.Selection.Text.Length > 0 Then ' Text Selected
If TypeOf Editor.Selection.GetPropertyValue(Run.FontWeightProperty) Is FontWeight _
AndAlso DirectCast(Editor.Selection.GetPropertyValue(Run.FontWeightProperty), FontWeight) = FontWeights.Normal Then
Editor.Selection.SetPropertyValue(Run.FontWeightProperty, FontWeights.Bold)
Else
Editor.Selection.SetPropertyValue(Run.FontWeightProperty, FontWeights.Normal)
End If
End If
Editor.Focus()
Example in XAML:
<Paragraph TextAlignment="Right">Example</Paragraph>
The above works in the contents of a RichTextBox however I need to do this programatically based on a selection - like in WordPad.
Using silverlight 4 released version, this is how I did it.
Editor.Selection.ApplyPropertyValue(Paragraph.TextAlignmentProperty, TextAlignment.Left)
That assumes that your text that you will be justifying is currently selected.
Looks like the RichTextArea does not support this as yet in the Silverlight 4 beta, although it is possible to populate a RichTextArea with Paragraph elements with a particular TextAlignment in code and XAML you cannot do it on a Selection as this does not expose the "Block" or "Paragraph" element selected just the "Run".