Click here to Skip to main content
15,557,965 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I NEED TO CREATE A SEARCH BAR IN MY UWP APP
XML
<pre>  <ListView FontSize="10" FontWeight="SemiBold" Foreground="White"  Grid.Row="0" FontFamily="Arial Black" >
            <ListView.ItemsPanel>
                <ItemsPanelTemplate>
                    <ItemsStackPanel   Orientation="Horizontal"  VerticalAlignment="Top"
                                    Background="Transparent"   Width="auto"/>
                </ItemsPanelTemplate>
            </ListView.ItemsPanel>

            <x:String >NAME</x:String>
            <x:String>AGE</x:String>
            <x:String>ENGLISH</x:String>
            <x:String>TAMIL</x:String>
            <x:String>MATH</x:String>
        </ListView>
        
        <ListView x:Name="content"  Grid.Row="1" SelectionChanged="content_SelectionChanged"  ItemsSource="{x:Bind Customers}"
    HorizontalAlignment="Stretch"
    VerticalAlignment="Top" MinWidth="44" Background="Transparent">
            <ListView.ItemTemplate>
                <DataTemplate x:DataType="x:Bind">

                    <StackPanel  Margin="0,0,0,5" x:Name="row2"  Background="White" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="auto">
                      
                        <TextBlock Text="{Binding Name,Mode=TwoWay}"
                                   Margin="3,0,36,0"
                            FontSize="13" 
                            FontStyle="Italic" 
                           FontWeight="Bold"
                           Foreground="DarkBlue"
                               Height="36"
                                Width="63"  Style="{StaticResource TitleTextBlockStyle}"         
                        />

                        <TextBlock Text="{Binding age ,Mode=TwoWay}"
                                    Margin="0,0,3,0"
                                  FontSize="13" 
                           FontStyle="Italic" 
                           FontWeight="Bold"
                           Foreground="DarkBlue"
                                   Height="36"
                               Style="{StaticResource TitleTextBlockStyle}"   
                        />


What I have tried:

<pre lang="C#">    public class Customer
    {
        public object Id { get; set; }
        public object Name { get; set; }
        public object age { get; set; }
        public int mark { get; set; }
        public int mark1 { get; set; }
        public int mark2 { get; set; }

        public int Total => mark + mark1 + mark2;

    }


    public sealed partial class MainPage : Page
    {

        public ObservableCollection<Customer> Customers { get; } = new ObservableCollection<Customer>();
       
        

        public MainPage()
        {

            this.InitializeComponent();
            Customers.Add(new Customer() { Id = 1, Name = "NAME 1", age = 20, mark = 55, mark1 = 73, mark2 = 27 });
            Customers.Add(new Customer() { Id = 2, Name = "NAME 2", age = 20, mark = 46, mark1 = 53, mark2 = 52 });
        
        }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900