This is a migrated thread and some comments may be shown as answers.

Can we have AutoComplete with two ValueMemberPath?

0 Answers 21 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
saravanakumar subramaniam
Top achievements
Rank 1
saravanakumar subramaniam asked on 08 Dec 2011, 03:21 PM
Hi,

I am using AutoComplete textbox to find the user. I have bind the User object(FirstName, LastName, Id, EmailID) tot he autocompleted text box item source. I need to do the filter based on firstname and LastName. Where as i as able to filter only by single field "FirstName" or "LastName".

Is there any way we can filter the data using both FirstName and LastName?

<sdk:AutoCompleteBox x:Name="txtAutoUserID"
                Grid.Row="1" Height="25"
                MinimumPopulateDelay="50"
                ToolTipService.ToolTip="Enter Minimum 4 characters to fetch the user details"
                ItemsSource="{Binding UserList}"
                VerticalAlignment="Center"
                FilterMode="StartsWith"
                MinimumPrefixLength="2"
                SelectedItem="{Binding SelectedUser, Mode=TwoWay}"
                ValueMemberBinding="{Binding FirstName}"
                ValueMemberPath="sdf" Grid.ColumnSpan="2" Margin="0,0,5,0" Grid.Column="1">
           
                     <sdk:AutoCompleteBox.ItemTemplate>
                    <DataTemplate>
                        <Grid >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Border Grid.Column="0" x:Name="brdFirstName" Style="{StaticResource BorderStyle_normal}"   Margin="0,0,0,0"  BorderThickness="1,1,0,1" Width="150" >
                               
                                <TextBlock   HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding FirstName}" FontFamily="Verdana" />
                               
                            </Border>

                            <Border  Grid.Column="1" x:Name="brdLastName" BorderThickness="1,1,0,1" Margin="0,0,0,0" Style="{StaticResource BorderStyle_normal}" Width="150">
                               
                                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"  FontFamily="Verdana" Text="{Binding LastName}" />
                               
                            </Border>
                            <Border  Grid.Column="2" x:Name="brdUserId" BorderThickness="1,1,0,1" Margin="0,0,0,0" Style="{StaticResource BorderStyle_normal}" Width="150" >

                                <TextBlock  HorizontalAlignment="Center" VerticalAlignment="Center"  FontFamily="Verdana" Text="{Binding Id}" />
                            </Border>
                            <Border  Grid.Column="3" x:Name="brdEmail" BorderThickness="1,1,1,1" Margin="0,0,0,0" Style="{StaticResource BorderStyle_normal}" Width="150" >

                                <TextBlock  HorizontalAlignment="Center" VerticalAlignment="Center"  FontFamily="Verdana" Text="{Binding Email}" />
                            </Border>
                        </Grid>
                    
                      
                    </DataTemplate>
                </sdk:AutoCompleteBox.ItemTemplate>
                <interactivity:Interaction.Behaviors>
                    <utilities:FilterAsyncBehavior FilterAsyncCommand="{Binding AutoUserListAsyncCommand}" />
                </interactivity:Interaction.Behaviors>
            </sdk:AutoCompleteBox>

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
saravanakumar subramaniam
Top achievements
Rank 1
Share this question
or