Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Horizontal scrollbar in empty listview disappears

Horizontal scrollbar in empty listview disappears

Scheduled Pinned Locked Moved WPF
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pankaj Chamria
    wrote on last edited by
    #1

    Hi, I have a listview as below: <Window x:Class="Practice.WPF.ListViewTest" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ListViewTest" Height="300" Width="75" Closed="Window_Closed"> <ListView x:Name="listView" ScrollViewer.IsDeferredScrollingEnabled="True" VirtualizingStackPanel.IsVirtualizing="True"> <ListView.View > <GridView > <GridViewColumn Header="Id" DisplayMemberBinding="{Binding Path=Id}"></GridViewColumn> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=Name}"></GridViewColumn> <GridViewColumn Header="Price" DisplayMemberBinding="{Binding Path=Price}"></GridViewColumn> <GridViewColumn Header="Date" DisplayMemberBinding="{Binding Path=Date}"> </GridViewColumn> <GridViewColumn Header="Quantity" DisplayMemberBinding="{Binding Path=Quantity}"></GridViewColumn> </GridView> </ListView.View> </ListView> </Grid> </Window> The problem is when there is no data bound to the listview the horizontal scrollbar disappears, and the Headers get cut off. I want the horizontal scrollbar to be still visible. (My requirement may sound weird, but i want this functionality for a listview which displays streaming numerical data and has filters on column headers. Sometimes the filter condition does not satisfy any of the rows so the listview becomes empty and horizontal scrollbar disappears. Now some of the columns will get cut off and the user cannot scroll to that column and clear the filter.) ANy ideas how i achieve this.

    Pankaj Chamria, Software Programmer.

    A 1 Reply Last reply
    0
    • P Pankaj Chamria

      Hi, I have a listview as below: <Window x:Class="Practice.WPF.ListViewTest" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ListViewTest" Height="300" Width="75" Closed="Window_Closed"> <ListView x:Name="listView" ScrollViewer.IsDeferredScrollingEnabled="True" VirtualizingStackPanel.IsVirtualizing="True"> <ListView.View > <GridView > <GridViewColumn Header="Id" DisplayMemberBinding="{Binding Path=Id}"></GridViewColumn> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=Name}"></GridViewColumn> <GridViewColumn Header="Price" DisplayMemberBinding="{Binding Path=Price}"></GridViewColumn> <GridViewColumn Header="Date" DisplayMemberBinding="{Binding Path=Date}"> </GridViewColumn> <GridViewColumn Header="Quantity" DisplayMemberBinding="{Binding Path=Quantity}"></GridViewColumn> </GridView> </ListView.View> </ListView> </Grid> </Window> The problem is when there is no data bound to the listview the horizontal scrollbar disappears, and the Headers get cut off. I want the horizontal scrollbar to be still visible. (My requirement may sound weird, but i want this functionality for a listview which displays streaming numerical data and has filters on column headers. Sometimes the filter condition does not satisfy any of the rows so the listview becomes empty and horizontal scrollbar disappears. Now some of the columns will get cut off and the user cannot scroll to that column and clear the filter.) ANy ideas how i achieve this.

      Pankaj Chamria, Software Programmer.

      A Offline
      A Offline
      ABitSmart
      wrote on last edited by
      #2

      Take a look at this Link[^]

      P 1 Reply Last reply
      0
      • A ABitSmart

        Take a look at this Link[^]

        P Offline
        P Offline
        Pankaj Chamria
        wrote on last edited by
        #3

        Thanks for your reply. I looked at the Link. However the solution of having two scrollbars for header and content is an overkill and quite complex [at least for a beginner like me:)]. I have handled the problem by allowing the user to reset all the filters using a workaround, to get back the data and with it the scrollbars.

        Pankaj Chamria, Software Programmer.

        A 1 Reply Last reply
        0
        • P Pankaj Chamria

          Thanks for your reply. I looked at the Link. However the solution of having two scrollbars for header and content is an overkill and quite complex [at least for a beginner like me:)]. I have handled the problem by allowing the user to reset all the filters using a workaround, to get back the data and with it the scrollbars.

          Pankaj Chamria, Software Programmer.

          A Offline
          A Offline
          ABitSmart
          wrote on last edited by
          #4

          Appreciate your reply. Good to know you will have happy users now :)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups