Can we have AutoComplete with two ValueMemberPath?

1 posts, 0 answers
  1. saravanakumar subramaniam
    saravanakumar subramaniam avatar
    28 posts
    Member since:
    May 2010

    Posted 08 Dec 2011 Link to this post

    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>
Back to Top