provençal le breton
provençal le breton

Reputation: 1438

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.

Upvotes: 1

Views: 1231

Answers (3)

Hasmukh Savaliya
Hasmukh Savaliya

Reputation: 59

Please use setter property of AutoCompleteBox to set text alignment like follow:

<toolkit:AutoCompleteBox.TextBoxStyle>
    <Style TargetType="TextBox">
    <Setter Property="TextAlignment" Value="Center"></Setter>
    </Style>
</toolkit:AutoCompleteBox.TextBoxStyle> 

Thanks...

Upvotes: 2

Jignesh.Raj
Jignesh.Raj

Reputation: 5987

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>

Upvotes: 3

Nair
Nair

Reputation: 7458

Take a look at the following url http://social.msdn.microsoft.com/Forums/en-US/silverlightarchieve/thread/d41d201d-834f-4f8a-8b78-122ff08dd830/ this might help.

Upvotes: 1

Related Questions