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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:36:09+00:00 2026-05-13T06:36:09+00:00

I have a list view that is displaying data using the gridview. This list

  • 0

I have a list view that is displaying data using the gridview. This list is displaying data typical of grid views. Lots of data displayed in rows and columns. However, on some rows I do not have any data to display, in the columns. I would like to swap out the item template for that row and display another template for the entire row that would display something like “blank row” or “empty row” for the text and also style the whole row not the individual cells.

I have been trying to use this post: http://cloudstore.blogspot.com/2008/06/creating-custom-view-mode-that-supports.html.

So I have a custom view for the list view. Basically, I have subclassed the GridView class and on the PrepareItems method override, I can select the new template that I want to display for a particular row or the default template. However, when I try to select a new template, the gridview will never render anything for that row. It will still render if I use the default template. I assume that the layout for a GridView is interfering with my setting of the template for the row I want to swap out. Is this possible or will I have to create a custom view that mimics the GridView and not subclass the GridView class? I would like to keep the columns the way they are without too much rework. Any suggestions or anyone have experience with this type of scenario?

  • 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-13T06:36:09+00:00Added an answer on May 13, 2026 at 6:36 am

    Okay here is what I did to solve my problem, however it will incur some rework on my part. I replaced with my listview with an items control. So I am not using the GridView of the list view anymore. Instead I defined a GridViewColumnCollection with my columns set up with how I wanted them.

    For my header I used a GridViewHeaderRowPresenter with its columns property bound to GridViewColumnCollection. This takes care of the Column Headers.

    Underneath my header I insert the ItemsControl which is bound to my items list. However, I now use a DataTemplateSelector that will swap the template out depending on the item and its properties. If you are unfamiliar with the DataTemplate Selector go here: data template selector

    Basically, my default template for items in the list is a GridViewRowPresenter which its columns property is bound to GridViewColumnCollection. This keeps it in line with the headers. However, I can still swap out the template for a row to be something else through the Data Template Selector. And this solves my problem.

    However, I now have to rework out of a listview with a gridview that I had styled, and use this method. So this does not come without some cost.

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

Sidebar

Ask A Question

Stats

  • Questions 428k
  • Answers 428k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer For different x-scales use twiny() (think of this as "shared… May 15, 2026 at 1:19 pm
  • Editorial Team
    Editorial Team added an answer MVC is an UI pattern, three tier is an application… May 15, 2026 at 1:19 pm
  • Editorial Team
    Editorial Team added an answer Sample Code public static void main(String a[]){ //Other code omitted… May 15, 2026 at 1:19 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.