2
Vote

TextBox does not work

description

I am trying to use this Textbox with the following:
<bidi:TextBox x:Name="bidiBox" FlowDirection="RightToLeft" Width="200" Height="100"/>
 
But when I enter "This is a test". It could not display correctly. Please attached image. I must be doing something wrong obviously. Any idea why?
 
I am using Silverlight RTM.

file attachments

comments

Illuminaty wrote Apr 15, 2009 at 4:49 PM

Hi,
yep the TextBox doesn't work.
I had the same problem when trying to fix an AutoCompleteBox.
I kinda found a solution to a normal TextBox - It works from within the AutoCompleteBox template, I assume it will work on a normal System.Windows.Conrols.TextBox :
    private string m_AutoCompleteOriginal = "";

    private void AutoComplete_Template_TextChanged(object sender, TextChangedEventArgs e)
    {
        StackPanel sp = System.Windows.Media.VisualTreeHelper.GetChild(System.Windows.Media.VisualTreeHelper.GetChild(AddQuote_TextBox, 0), 0) as StackPanel;
        TextBox BidiTB = (TextBox)sp.Children[1];

        if (BidiTB.Text.Length > 0)
        {
            string uppered = BidiTB.Text.ToUpper();
            if (uppered[0] >= 'A' && uppered[0] <= 'Z')
            {
                m_AutoCompleteOriginal = BidiTB.Text;
                ((LocItem)Resources["AutoCompleteVal"]).ItemValue = ((TextBox)sender).Text;
            }
            else
            {
                if (m_AutoCompleteOriginal.Length < BidiTB.Text.Length)
                {
                    m_AutoCompleteOriginal += BidiTB.Text[0];

                    BidiTB.Text = m_AutoCompleteOriginal.reverse();
                    ((LocItem)Resources["AutoCompleteVal"]).ItemValue = ((TextBox)sender).Text.reverse();
                }
                else
                    if (m_AutoCompleteOriginal.Length > BidiTB.Text.Length)
                    {
                        m_AutoCompleteOriginal = m_AutoCompleteOriginal.Substring(0, m_AutoCompleteOriginal.Length - 1);
                        ((LocItem)Resources["AutoCompleteVal"]).ItemValue = ((TextBox)sender).Text.reverse();

                    }
                BidiTB.SelectionStart = 0;
            }
        }
        else
        {
            m_AutoCompleteOriginal = "";
        }
    }
Hope it helps,

Netanel KL
http://www.fxg.co.il

wrote Feb 12, 2013 at 9:31 PM