Search code examples
xamlsilverlight-4.0autocompletebox

Text Align Left in an autocomplete box


I am searching how to align left the text in a AutoCompleteBox

So I details,

the result is too long for the textbox associated to autocomplete box, so, there is a missing part.

if the result is : "result of my autocomplete box", when I click and choose it, it's display on the textbox.

But the part display is : "f my autocomplete box", and I want "result of my autocomplete".

Here is my xaml :

<myControl:AutoCompleteBox x:Name="acp" Grid.Row="0" Grid.Column="1" 
           HorizontalAlignment="Left" VerticalAlignment="Top"  
           IsTabStop="False" 
           MinimumPrefixLength="3" 
           ItemTemplate="{StaticResource ItemTemplate}" 
           ValueMemberBinding="{Binding FullName}"
           ItemsSource="{Binding Data, ElementName=MySource}" 
           Text="{Binding FullName, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}" 
           Width="150" 
           IsTextCompletionEnabled="False" 
           FilterMode="None" IsDropDownOpen="True"/>

I hope i'm clear. Thank you.


Solution

  • you should try This

    <my:AutoCompleteBox Name="acbNames" ValueMemberBinding="{Binding FullName}">
        <my:AutoCompleteBox.ItemTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding FullName}" TextAlignment="Left"/>
            </DataTemplate>
        </my:AutoCompleteBox.ItemTemplate>
        </my:AutoCompleteBox>