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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:39:46+00:00 2026-05-26T14:39:46+00:00

I have a App.xaml template : <Application.Resources> <!– template for recent history –> <DataTemplate

  • 0

I have a App.xaml template :

<Application.Resources>
        <!-- template for recent history -->
        <DataTemplate x:Key="ListViewModelTemplate"> <!-- for recent recepies-->

            <Grid Width="400" Height="80" VerticalAlignment="Center">

                <StackPanel Orientation="Vertical">
                <Border CornerRadius="0" x:Name="brdTesat" BorderBrush="Black" BorderThickness="1" Width="80" Height="80">

                <Border.Background>
                    <ImageBrush x:Name="backgroundImaageBrush" Stretch="Fill">

                        <ImageBrush.ImageSource>

                                <BitmapImage x:Name="bmapBackground" UriSource="{Binding imageUriPath}" >
                            </BitmapImage>

                        </ImageBrush.ImageSource>
                    </ImageBrush>
                </Border.Background>
            </Border>
                <StackPanel>
                <TextBlock TextAlignment="Left" Margin="7,4,4,4" Text="{Binding title}" TextWrapping="Wrap"></TextBlock>
                    <TextBlock TextAlignment="Left" Margin="7,4,4,4" Text="{Binding subTitle}" TextWrapping="Wrap"></TextBlock>
                </StackPanel>
            </StackPanel>

        </Grid>
    </DataTemplate>

and try to call it to display in a ListBox.. The problem is that the listbox although bound to data, doesn’t know how to work with the template. Here is my listbox definition :

<ListBox x:Name="recepiesList"  ItemsSource="{Binding recepiesList}" ItemTemplate="{StaticResource ListViewModelTemplate}"  >

if i define a template in place, like

<ListBox.Template><DataTemplate><TextBlock text={Binding title} /></DataTemplate></ListBox.Template>

the listbox works great, but i need to correct my Application.Resources one. How can i do so?

  • 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-05-26T14:39:47+00:00Added an answer on May 26, 2026 at 2:39 pm

    Here is the correct DataTemplate

     <DataTemplate x:Key="ListViewModelTemplate"> <!-- for recent recepies-->
    
                    <!-- for recent recepies-->
                    <StackPanel Orientation="Horizontal">
                        <Border CornerRadius="0" x:Name="brdTesat" BorderBrush="White" BorderThickness="1" Width="80" Height="80">
    
                            <Border.Background>
                                <ImageBrush x:Name="backgroundImaageBrush" Stretch="Fill">
    
                                    <ImageBrush.ImageSource >
    
                                        <BitmapImage x:Name="bmapBackground"  UriSource="{Binding imageUriPath}" >
                                        </BitmapImage>
    
                                    </ImageBrush.ImageSource>
                                </ImageBrush>
                            </Border.Background>
                        </Border>
                        <StackPanel >
                            <TextBlock TextAlignment="Left" Margin="7,4,4,4" Text="{Binding title}" TextWrapping="Wrap"></TextBlock>
                            <TextBlock TextAlignment="Left" Margin="7,4,4,4" Text="{Binding subTitle}" TextWrapping="Wrap"></TextBlock>
                        </StackPanel>
                    </StackPanel>
    
    
                </DataTemplate>
    

    The Grid seemed to produce a problem..

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

Sidebar

Related Questions

I have a DataTemplate in app.xaml that binds a view to a viewmodel. <Application.Resources>
i have a hard problem dealing with template. please help me. App.xaml <Application x:Class=WpfApplication1.App
I have custom classes that I currently instantiate within App.xaml as resources. I want
Guys, I have a basic WPF application. Contains App.xaml as always and a Mainwindow.xaml.
I have an app built with the Silverlight Navigation Application Template. I have a
I'm developing a WPF app using MVVM. Most of my views have only xaml
I have app.config in m win application, and loggingConfiguration section (enterprise library 4.1). I
I have a business application (created from template) and I can change language dynamically
My situation is like following. I have a App.xaml which includes Style for ListView
I have a data template for my listbox and I must use project resources

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.