Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hello
                                    It is possible to change these properties of the CardView in GridControl?

                                    CardCollapsedOrientation (or similar I have found only a readonly property)

                                    AutoWidth (I would like to set the cardwidth to occupy the whole grid width)

                                    KR
                                    Laszlo Schaffer
                                    SW Developer
                                    KSEngineers
                                    Graz
                                    Austria



                                You must  log in  or  register  to leave comments

                                1 Solution

                                0

                                Hello Laszlo,
                                To change the orientation of collapsed cards, specify the CardLayout property. As for the AutoWidth, I am afraid there is no such property in the CardView. However, you can achieve this functionality using the CardStyle property. I have attached a sample project to illustrate this approach.

                                Thanks,
                                Alexander Rus

                                Q491835.zip
                                Show all comments
                                • Laszlo Schaffer 04.30.2013

                                  Hello
                                  Thanks for this sample however for me it does not work, the cardview is built up runtime (depending on other properties the table can have table/card/tree view ) I have tried to set the width in code
                                  like this
                                          private void dataGridEntityView_SizeChanged(object sender, SizeChangedEventArgs e)
                                          {
                                              if (dataGridEntityView.View is CardView)
                                              {
                                                  (dataGridEntityView.View as CardView).Width = dataGridEntityView.ActualWidth - 20;
                                              }
                                          }
                                  but the card objects have differents width see the attached image
                                  I would like to set the maxwidth of each card object if it is possible
                                  I see that the problem is that the the card object accept the width of the content so it would be enough to limit the width of the displayed content (?)

                                  KR
                                  Laszlo Schaffer
                                  KSEngineers
                                  Graz
                                  Austria

                                • Alexander Rus (DevExpress Support) 04.30.2013

                                  Hello,
                                  If you change the view dynamically, the easiest way to accomplish this task is to find the cardStyle in the resources and assign it to the CardView.CardStyle property when the CardView is created:

                                  gridControl1.View = new CardView() { CardStyle = this.Resources["cardStyle"] as Style };
                                  It is also necessary to modify the binding in the following manner:
                                  <Setter Property="Width" Value="{Binding Path=ActualWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=dxg:CardView}, Converter={local:WidthConverter}}"/>
                                  I have updated my project to demonstrate how it works.

                                  Thanks,
                                  Alexander Rus

                                • Laszlo Schaffer 04.30.2013

                                  Thanks
                                  It is working now
                                  KR
                                  Laszlo Schaffer

                                • Alexander Rus (DevExpress Support) 04.30.2013

                                  You are welcome, Laszlo! I am glad to hear that the issue has been resolved.

                                • Laszlo Schaffer 04.30.2013

                                  Hello
                                  I have another question
                                  How can I add a gridcolumn cell to a custom control?
                                  The custom control is a dx layoutcontrol and built up runtime (so I do not have xaml template)
                                  The grid is also built up runtime

                                  It is possible to do this?

                                  KR
                                  Laszlo Schaffer

                                • Alexander Rus (DevExpress Support) 04.30.2013

                                  I am afraid your requirements are not quite clear to me. Do you wish to wrap cards into a LayoutControl? Would you please describe your end goal in greater detail?

                                  Thanks,
                                  Alexander Rus

                                • Laszlo Schaffer 04.30.2013

                                  Sorry I have written in bad direction
                                  So it is possible to set the content of a grid cell from a custom control
                                  (gridCol.CellTemplate = new ControlTemplate { ......new mycustomcontrol }....)

                                  KR
                                  Laszlo Schaffer

                                • Alexander Rus (DevExpress Support) 04.30.2013

                                  Yes, you can put a custom control into a cell:

                                                      <dxg:GridColumn.CellTemplate>
                                                          <DataTemplate>
                                                              <Button/>
                                                          </DataTemplate>
                                                      </dxg:GridColumn.CellTemplate>
                                  If you wish to change the representation of card, use the CardTemplate property:
                                                      <dxg:CardView.CardTemplate>
                                                          <DataTemplate>
                                                              <Button/>
                                                          </DataTemplate>
                                                      </dxg:CardView.CardTemplate> 

                                  Thanks,
                                  Alexander Rus

                                • Laszlo Schaffer 05.02.2013

                                  Hello
                                  Thanks,
                                  I have now another Problem
                                  I need to implement an image editor that (for either form or grid content) where the image is built up path+filename so I can not bind directly to a column, I made an unbound column
                                  The image source is not an image file but I have to read from an SolidEdge tool (this part is working)

                                  I made a test but the editor does not work as it expected , the grid data is loading the images are rendered but if an image source is empty then not an empty but the last showed image is displayed in the cell.
                                  In edit mode it works (both the path and file name properties are stored back to the given row)
                                  But sometimes they are empty and in new record mode it does not work alsp

                                  so I have a template

                                   <DataTemplate x:Key="seImageDisplayTemplate" >
                                                                          <local:SEImageEditor Source="{Binding Value,Converter={StaticResource imageConverter}}" Entity="{Binding RowData.Row}" Height="128" Width="128" />
                                                                      </DataTemplate>

                                                                      <ControlTemplate x:Key="seImageEditTemplate" >
                                                                          <local:SEImageEditor x:Name="PART_Editor" Source="{Binding Value,Converter={StaticResource imageConverter}}" Entity="{Binding RowData.Row}" Height="128" Width="128" />
                                                                      </ControlTemplate>

                                  the grid is built up runtime from a model definition so I bind this template to the unbound column so
                                     else if (ev.EditorType == EditorTypes.COMPLEX_SE_PICTURE_FROM_PATH)
                                                      {
                                                          
                                                          DataTemplate seDisplayTemplate = dataGrid.Resources["seImageDisplayTemplate"] as DataTemplate;
                                                          ControlTemplate seEditTemplate = dataGrid.Resources["seImageEditTemplate"] as ControlTemplate;
                                                          
                                                          col.CellTemplate = seDisplayTemplate;
                                                          col.EditTemplate = seEditTemplate;

                                                      }

                                  N

                                  Hereby the source of the converter and the imageeditor in zip

                                  KR
                                  Laszlo Schaffer

                                • Alexander Rus (DevExpress Support) 05.02.2013

                                  Hello Laszlo,
                                  In order not to mix several issues in one ticket, I have created a separate thread on your behalf: Q374111: Custom ImageEdit in a grid cell. Please refer to it for further discussion.

                                  Thanks,
                                  Alexander Rus

                                You must  log in  or  register  to leave comments

                                To start a chat you should create a support ticket


                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners