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. ListView Scrolling with MVVM

ListView Scrolling with MVVM

Scheduled Pinned Locked Moved WPF
wpfarchitecture
5 Posts 3 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.
  • K Offline
    K Offline
    krishnan s
    wrote on last edited by
    #1

    Hi , I need to acheive List View Scrolling with MVVM. As iam new to MVVM Can u please let me know how it can be acheived . Can anyone please provide a sample for the same if possible. Thanks Krish

    A K 2 Replies Last reply
    0
    • K krishnan s

      Hi , I need to acheive List View Scrolling with MVVM. As iam new to MVVM Can u please let me know how it can be acheived . Can anyone please provide a sample for the same if possible. Thanks Krish

      A Offline
      A Offline
      Abhinav S
      wrote on last edited by
      #2

      Listview scrolling in general has nothing to do with MVVM and is an inherent property of the control. Could you please give more details so we can understand your question better?

      The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick Visit the Hindi forum here.

      1 Reply Last reply
      0
      • K krishnan s

        Hi , I need to acheive List View Scrolling with MVVM. As iam new to MVVM Can u please let me know how it can be acheived . Can anyone please provide a sample for the same if possible. Thanks Krish

        K Offline
        K Offline
        krishnan s
        wrote on last edited by
        #3

        I need to scroll the listview on a button click. Iam following MVVM pattern. I tried the following but it is not working. <local:SortableListView x:Name="headLinesGridView" IsSynchronizedWithCurrentItem="True" Style="{DynamicResource ListViewStyle}" ScrollViewer.VerticalScrollBarVisibility="Hidden" ItemsSource="{Binding Source={StaticResource TestDataSource}}" ItemContainerStyle="{StaticResource headLinesGridViewStyle}" ColumnHeaderSortedAscendingTemplate="HeaderTemplateArrowUp" ColumnHeaderSortedDescendingTemplate="HeaderTemplateArrowDown" ColumnHeaderNotSortedTemplate="HeaderTemplateTransparent"> <ListView.View> <GridView ColumnHeaderContainerStyle="{StaticResource gridViewHeaderStyle}" ColumnHeaderTemplate="{StaticResource HeaderTemplateTransparent}"> <local:SortableGridViewColumn Header="ID" DisplayMemberBinding="{Binding ID}" SortPropertyName="ID" Width="50" /> <local:SortableGridViewColumn Header="First Name" DisplayMemberBinding="{Binding FirstName}" SortPropertyName="FirstName" IsDefaultSortColumn="True"/> <local:SortableGridViewColumn Header="Last Name" DisplayMemberBinding="{Binding LastName}" SortPropertyName="LastName" /> <local:SortableGridViewColumn Header="Date of Birth" DisplayMemberBinding="{Binding DateOfBirth}" SortPropertyName="DateOfBirth" /> <local:SortableGridViewColumn Header="QueueStatus" SortPropertyName="QueueStatus" IsDefaultSortColumn="True" CellTemplate="{StaticResource IconCellTemplate}"/> </GridView> </ListView.View> <ListView.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Orientation="Vertical"></WrapPanel> </ItemsPanelTemplate> </ListView.ItemsPanel> </local:SortableListView> <Button Grid.Row="1" Command="ScrollBar.LineDownCommand" CommandTarget="{Binding ElementName = Test}">Scroll Down</Button>

        P 1 Reply Last reply
        0
        • K krishnan s

          I need to scroll the listview on a button click. Iam following MVVM pattern. I tried the following but it is not working. <local:SortableListView x:Name="headLinesGridView" IsSynchronizedWithCurrentItem="True" Style="{DynamicResource ListViewStyle}" ScrollViewer.VerticalScrollBarVisibility="Hidden" ItemsSource="{Binding Source={StaticResource TestDataSource}}" ItemContainerStyle="{StaticResource headLinesGridViewStyle}" ColumnHeaderSortedAscendingTemplate="HeaderTemplateArrowUp" ColumnHeaderSortedDescendingTemplate="HeaderTemplateArrowDown" ColumnHeaderNotSortedTemplate="HeaderTemplateTransparent"> <ListView.View> <GridView ColumnHeaderContainerStyle="{StaticResource gridViewHeaderStyle}" ColumnHeaderTemplate="{StaticResource HeaderTemplateTransparent}"> <local:SortableGridViewColumn Header="ID" DisplayMemberBinding="{Binding ID}" SortPropertyName="ID" Width="50" /> <local:SortableGridViewColumn Header="First Name" DisplayMemberBinding="{Binding FirstName}" SortPropertyName="FirstName" IsDefaultSortColumn="True"/> <local:SortableGridViewColumn Header="Last Name" DisplayMemberBinding="{Binding LastName}" SortPropertyName="LastName" /> <local:SortableGridViewColumn Header="Date of Birth" DisplayMemberBinding="{Binding DateOfBirth}" SortPropertyName="DateOfBirth" /> <local:SortableGridViewColumn Header="QueueStatus" SortPropertyName="QueueStatus" IsDefaultSortColumn="True" CellTemplate="{StaticResource IconCellTemplate}"/> </GridView> </ListView.View> <ListView.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Orientation="Vertical"></WrapPanel> </ItemsPanelTemplate> </ListView.ItemsPanel> </local:SortableListView> <Button Grid.Row="1" Command="ScrollBar.LineDownCommand" CommandTarget="{Binding ElementName = Test}">Scroll Down</Button>

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          This is a common mistake in MVVM, trying to do too much in the VM. As this line down operation has absolutely no bearing on the model, it's perfectly fine to do this in code behind the view; after all, you just want to move the scrollbar on a visual. Go for it.

          I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

          Forgive your enemies - it messes with their heads

          My blog | My articles | MoXAML PowerToys | Onyx

          A 1 Reply Last reply
          0
          • P Pete OHanlon

            This is a common mistake in MVVM, trying to do too much in the VM. As this line down operation has absolutely no bearing on the model, it's perfectly fine to do this in code behind the view; after all, you just want to move the scrollbar on a visual. Go for it.

            I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

            Forgive your enemies - it messes with their heads

            My blog | My articles | MoXAML PowerToys | Onyx

            A Offline
            A Offline
            Abhinav S
            wrote on last edited by
            #5

            :thumbsup:

            The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick Visit the Hindi forum here.

            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