Home Forums WPF controls Xceed DataGrid for WPF CardView vertical scrolling

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #21549 |

    Is there any way to make the CardView scroll vertically instead of horizontally? I can probably create a new style/template, but I wanted to know if there was a property that I could set instead.

    Thanks,
    Joe

    Imported from legacy forums. Posted by Joe (had 6453 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Joe,

    You can achieve this by overriding the DataGridControl.ItemsPanel property:

    <code>
    <DataGridControl>
    <DataGridControl.ItemsPanel>
    <ItemsPanelTemplate>
    <VirtualizingCardPanel Orientation=”Horizontal”/>
    </ItemsPanelTemplate>
    </DataGridControl.ItemsPanel>
    </DataGridControl>
    </code>

    Note: The VirtualizingCardPanel is part of the Xceed.Wpf.DataGrid namespace.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 761 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks, that worked great.

    Joe

    Imported from legacy forums. Posted by Joe (had 814 views)

    User (Old forums)
    Member
    Post count: 23064

    How do you do this in-code?

    Imported from legacy forums. Posted by Berin (had 726 views)

    Xceed Support
    Member
    Post count: 5658

    <code>
    FrameworkElementFactory myPanel = new FrameworkElementFactory( typeof( VirtualizingCardPanel ) );
    myPanel.SetValue( VirtualizingCardPanel.OrientationProperty, Orientation.Horizontal );

    myGrid.ItemsPanel = new ItemsPanelTemplate( myPanel );
    </code>

    Imported from legacy forums. Posted by Marcus [Xceed] (had 617 views)

    User (Old forums)
    Member
    Post count: 23064

    Awesome, Thank you! 😀

    Imported from legacy forums. Posted by Berin (had 634 views)

    User (Old forums)
    Member
    Post count: 23064

    I just switched my orientation for my CardView to Horizontal.

    I have a DataTable binding to the grid with about 90 Records. Each row has about 14 columns. I can scroll down about half way (with my mousewheel), but beyond that it stops scrolling. (I have to “jerk” the scroll bar up and down a few times to get it to continue).
    This happens when i drag the scroll bar as well.

    Just thought you might like to know.

    Imported from legacy forums. Posted by Berin (had 919 views)

    Xceed Support
    Member
    Post count: 5658

    Thank you for the report, we will take a look into this.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 5587 views)

    User (Old forums)
    Member
    Post count: 23064

    I’ve tried both the XAML and code-behind solutions for this problem and neither of them has worked for me.  I’m getting a message that VirtualizingCardPanel is obsolete.  Does this have anything to do with my problem?

     

    Imported from legacy forums. Posted by Jeff (had 451 views)

    User (Old forums)
    Member
    Post count: 23064

    Yes, I have same problem with vertical scrolling in cardview.

    Could you please let me know how can I have vertical scroll-bar in cardview?

     

    Imported from legacy forums. Posted by Kyungjin (had 427 views)

    User (Old forums)
    Member
    Post count: 23064

    This can be done in version 3.0 by changing the ControlTemplate of the DataGridControl. Here is a example on how to do that:

     <Window.Resources>
      <ControlTemplate x:Key=”cardViewDataGridControlTemplate”
                        TargetType=”local:DataGridControl”>

          <Border Background=”{TemplateBinding Background}”
                  BorderBrush=”{TemplateBinding BorderBrush}”
                  BorderThickness=”{TemplateBinding BorderThickness}”>

            <!– The AdornerDecorator will allow visual cues for Drag & Drop operations. –>
            <AdornerDecorator x:Name=”PART_DragDropAdornerDecorator”>
                <!– The CardViewScrollViewer takes care of laying out the various sections of
                  a DataGrid in CardView: FixedHeaders, FixedFooters, etc. –>
                <xcdg:CardViewScrollViewer x:Name=”PART_ScrollViewer”
                                            Padding=”{TemplateBinding Padding}”>

                    <!– ORIENTATION CHANGED ON THIS ELEMENT –>
                    <xcdg:CardViewItemsHost Margin=”0,15,0,5″ Orientation=”Horizontal”
                                      FixedSize=”{Binding RelativeSource={RelativeSource Self}, Path=(xcdg:DataGridControl.DataGridContext).CardWidth, Mode=TwoWay}”
                                      AllowCardResize=”{Binding RelativeSource={RelativeSource Self}, Path=(xcdg:DataGridControl.DataGridContext).AllowCardResize}”
                                      SeparatorLinePen=”{Binding RelativeSource={RelativeSource Self}, Path=(xcdg:DataGridControl.DataGridContext).SeparatorLinePen}” />
                </xcdg:CardViewScrollViewer>
            </AdornerDecorator>

          </Border>

      </ControlTemplate>
     <Window.Resources>

    <xcdg:DataGridControl Template=”{StaticResource cardViewDataGridControlTemplate}”/>

    Note: ControlTemplate was extracted from “themes\common\CardView.GridElementTemplates.xaml”, from the installation folder of the package.

    Imported from legacy forums. Posted by André (had 1430 views)

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.