Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8089399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:22:58+00:00 2026-06-05T19:22:58+00:00

I want to create a windows phone screen which will display the some users

  • 0

I want to create a windows phone screen which will display the some users info in a listbox like following

enter image description here

Right now i am doing this using following code its working fine.

   <ListBox>
   <ListBoxItem Height="100">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="60"/>
                            <RowDefinition Height="40"/>
                            </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                            <Image Source="Assets/Users/dummyUser2.png" Grid.RowSpan="2" Grid.Column="0" Height="90" Width="90" />
                            <TextBlock Text="John Smith" Style="{StaticResource ProfileNameStyleForTextBlock}" />
                            <TextBlock Text="Birthday" Style="{StaticResource EventNameStyleForTextBlock}"   />
                            <TextBlock Text="Today" Style="{StaticResource EventDateStyleForTextBlock}" Foreground="#09aba9" />
                        </Grid>
                    </ListBoxItem>
   ...........
   ......
   </ListBox>

What i want to do is, i want to load the items into list box dynamically from code behind and the view should be look like above image.

Is it possible to create a style/control like this and add it to all the lists i’ll create in future.

Edit

My ListBox

<ListBox Name="lstlist" ItemTemplate="{StaticResource GuyDataTemplate}" />

DataTemplate

 <DataTemplate x:Key="GuyDataTemplate">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="60"/>
                <RowDefinition Height="40"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Image Source="Assets/Users/dummyUser2.png" Grid.RowSpan="2" Grid.Column="0" Height="90" Width="90" />
            <TextBlock Text="{Binding Name}" Style="{StaticResource ProfileNameStyleForTextBlock}" />
            <TextBlock Text="{Binding Event}" Style="{StaticResource EventNameStyleForTextBlock}"   />
            <TextBlock Text="{Binding Date}" Style="{StaticResource EventDateStyleForTextBlock}" Foreground="#09aba9" />
        </Grid>
    </DataTemplate>

I created a class as

public class Guy
{
    public string Name { get; set; }
    public string Event { get; set; }
    public string Date { get; set; }
}

and wrote the logic in a buttonclick

 ObservableCollection<Guy> Guys = new ObservableCollection<Guy>();
        Guys.Add(new Guy() { Name = "xyzabc", Event = "event details", Date = "19/25/0258" });
        Guys.Add(new Guy() { Name = "xyzabc", Event = "event details", Date = "19/25/0258" });
        Guys.Add(new Guy() { Name = "xyzabc", Event = "event details", Date = "19/25/0258" });
        Guys.Add(new Guy() { Name = "xyzabc", Event = "event details", Date = "19/25/0258" });

        lstlist.ItemsSource = Guys;

After adding this app got stucked

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:22:59+00:00Added an answer on June 5, 2026 at 7:22 pm

    define DataTemplate for ListBox item in resources :

               <DataTemplate x:Key="GuyDataTemplate">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="60"/>
                            <RowDefinition Height="40"/>
                            </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                            <Image Source="Assets/Users/dummyUser2.png" Grid.RowSpan="2" Grid.Column="0" Height="90" Width="90" />
                            <TextBlock Text="John Smith" Style="{StaticResource ProfileNameStyleForTextBlock}" FontWeight="ExtraBold" />
                            <TextBlock Text="Birthday" Style="{StaticResource EventNameStyleForTextBlock}"   />
                            <TextBlock Text="Today" Style="{StaticResource EventDateStyleForTextBlock}" Foreground="#09aba9" />
                        </Grid>
                    </DataTemplate>
    

    and use it from every ListBox you want:

    <ListBox ItemsSource={Binding Guys} ItemTemplate={StaticResource GuyDataTemplate} />
    

    , where Guys is ObservableCollection<>

    add new item:

    Guys.Add(new Guy() { Name = "Will Snith" });
    

    P.S.

    UserControl is not recommended to use as ListBox item

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a simple graphical editor for Windows Phone 7. User will
I want to create a windows phone 7.1 application to display a messaging counter.
I want to create an application bar like IE has in Windows Phone 7.1
I want to create a small app for Windows Phone, and it will based
how can create a windows move maker like application in vb.net.... if we want
I want to create a tabbed UI in windows phone app's single page. Closest
I am designing an application for Windows Phone 7, and I want to create
I would like create alarm clock at windows phone 7 mango , for this
I want to create an application that will show some predefined message each time
I want to create a simple audio player for Windows Phone 7. How can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.