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 8757209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:14:58+00:00 2026-06-13T14:14:58+00:00

I have one listbox control in my xaml par.My code for listbox is <ScrollViewer

  • 0

I have one listbox control in my xaml par.My code for listbox is

<ScrollViewer Grid.Row="2" Name="ScrollGrid" VerticalScrollBarVisibility="Auto" VerticalAlignment="Top" Height="Auto" Width="450" Margin="0,100,0,0" >
    <ListBox x:Name="TransactionList" Grid.Row="2" HorizontalAlignment="Center" Margin="0,0,0,0"  Width="400" Height="Auto">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="0,-10,0,0" Height="120" Width="400" MouseLeftButtonUp="StackPanel_MouseLeftButtonUp">

                    <StackPanel Orientation="Horizontal" VerticalAlignment="Top"  Height="80" Width="300" Margin="0,0,20,0">
                        <TextBlock Height="Auto" Margin="20,0,0,0" VerticalAlignment="Center" Text="vodafone vas" FontSize="30" Foreground="Gray" Name="tbCitynameFavorite"  />
                    </StackPanel>
                    <StackPanel Orientation="Vertical"  Height="60" Width="60" Margin="0,0,0,30">
                        <Image Name="imgfevdlt" Width="50" Height="40"  VerticalAlignment="Center" FlowDirection="LeftToRight" Source="/VodafoneAugmentedReality;component/Images/ArrowMoreSmall.png" />

                    </StackPanel>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"  Height="10" Width="350" Margin="-360,60,0,0">
                <Image Source="/VodafoneAugmentedReality;component/Images/SaperaterLine.png" Width="350" />
            </StackPanel>
        </StackPanel>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
</ScrollViewer> 

When i run application this will not display any data

But when i comment out this two tag than it will run perfectly

 <ListBox.ItemTemplate>
                    <DataTemplate>

Here i have only static value so it will ok but when i have multiple value than it will create problem
So plase help me i can solve this problem?

  • 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-13T14:14:59+00:00Added an answer on June 13, 2026 at 2:14 pm

    You will have to set up a class (say ListBoxItem ) which contains all the properties of your DataTemplate members values

    And then define a List of ListBoxItem ‘s and set it as the ItemSource of your ListBox

    Example code

    public class ListBoxItem
    {
       public string CityNameFavorite { set; get; }
       // Other required properties follows here
    }
    
    List<ListBoxItem> listBoxItems = new List<ListBoxItem>();
    listBoxItems.Add(new ListBoxItem() { CityNameFavorite = "Vodafone vas" });
    //Add as many items you need
    
    
    TransactionList.ItemsSource = listBoxItems;
    

    This is just an overview of how it can be achieved, improvise based on your needs

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

Sidebar

Related Questions

I currently have a list box set up as follows: .xaml: <ListBox Name=DetailsList ItemsSource={Binding}
I have three different List collections. How can I show them in one ListBox
If I have 2 .zul, one has a listbox, and another is the modal
I have managed to reproduce a weird behavior in the auto scrollviewer functionality of
I have a WPF listbox control that is declaratively bound to a textbox. The
I have a simple user control to display a hyperlink in a textblock: LinkTextBlock.xaml:
I have a listbox control on winform and same is Single Items SelectionMode OR
I have a control that we could identify as similar to ListBox control. Each
I have a user control that inherits from the ListBox class and displays a
I have the following XAML: <ListBox SelectedItem={Binding SelectedTeam}> <ListBoxItem Content={Binding Match.HomeTeam} /> <ListBoxItem Content={Binding

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.