This is a migrated thread and some comments may be shown as answers.

WPF Radgrid help

3 Answers 565 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Prash
Top achievements
Rank 1
Prash asked on 04 Feb 2009, 03:34 PM

Hello,


I have the following requirements/queries regarding the grid:

1) How easy is to accommodate other controls (like combobox,textbox,maskedtexbox) in the cell.

2) How easy is to template grid/cell/datarow

3) Binding with observable collection

4) What about validation, do we have any numeric text box, date time picker, ip address text box support.

5) Can we template grouping row.

6) Triggers/Data triggers/Multi triggers support

7) Icon/Card view support

8) Read only level (I.e. it should be at cell, column, row level)

9) Selective sorting support (i.e. can we specify which column to sort and which to not)

10) Does column adjust its width according to data content.

11) Templating datarow/datacell (for ex. Placing image in place of text content) is possible or not.

12) Inplace editing with two way binding.

13) Selective readonly support (i.e. can we specify which column should be readonly and which should not)

14) Can we get cell validation exception so that we can handle it accordingly.

15) In case the validation fails at certain cell does the focus remain on the same cell.

16) Validation exception - can we get them on grid lost focus.

17) Do we have support for events like – grouping, sorting, gridlostfocus, Celllostfocus, rowlostfocus,mouse events at cell/row/grid level etc.

18) Add new row support.

19) Support for deferred/Immediate scrolling.

20) Do we have automatic support for checkbox column (ie. If we bind a column to bool field then automatic checkbox should appear in that column, if not how to place checkbox in a clolumn bound to a bool field)

21) Can we template header row to say have a checkbox in header row to select all checkboxes of all the rows

22) Do we have support for fixed header and footers.

23) Number of themes available.

24) Do we have sample that shows ip address masking in the cell.

25) Context menu on grid rows.

26) Do we have functions to get object/item from the row/container and vice versa

Please suggest me how to achieve above requirements, a sample code will certainly help in meeting this requirements and preparing a demo application.

It will be helpful if you answer the queries with a yes/no.

Thanks in advance

 

 

 

3 Answers, 1 is accepted

Sort by
0
Prash
Top achievements
Rank 1
answered on 05 Feb 2009, 09:35 AM
Adding to the previous quesries, I also want to know wether it is possible to do validations on the cell level, e.g. if I want that the user should put the values between 1 to 20.

Any code sample will be helpful.
Thanks
0
Vlad
Telerik team
answered on 05 Feb 2009, 12:09 PM
Hi Prash,

Straight onto your questions:

1) By default the grid will create column editors based on the data type. For DateTime - DatePicker, for boolean ChekBox and so on. You can use also your own templates to define desired control.

2) Please check these demos:
http://blogs.telerik.com/vladimirenchev/posts/09-01-26/Custom_template_columns_with_RadGridView_for_Silverlight.aspx
http://blogs.telerik.com/vladimirenchev/posts/09-01-19/Detail_row_for_your_WPF_DataGrid_with_ADO_NET_DataService_binding.aspx
http://demos.telerik.com/wpf/?GridView/CustomRowLayout/ConditionalFormatting
http://demos.telerik.com/wpf/?GridView/CustomRowLayout/CardStyleRows
http://demos.telerik.com/wpf/?GridView/CustomRowLayout/TabularAndCustom

3) Please check this demo:
http://demos.telerik.com/wpf/?GridView/DataBinding

4) Please check this demo and column editors demo. Furthermore we will add masked editor for Q1 2009 (early March)

5) Using styles you can template everything!

6) Completely supported! You can refer to this post:
http://blogs.telerik.com/vladimirenchev/posts/09-01-19/Detail_row_for_your_WPF_DataGrid_with_ADO_NET_DataService_binding.aspx

7) Please check this demo:
http://demos.telerik.com/wpf/?GridView/CustomRowLayout/CardStyleRows

8) Currently only per column and per grid view.

9) Supported (IsSortable column property).

10) Supported (ColumnsWidthMode = ColumnsWidthMode.Auto)

11) Please check 1) and 2)

12) Supported.

13) Please check 8)

14) Pleas check this demo:
http://demos.telerik.com/wpf/?GridView/Validation

15) Please check 14)

16) Please check 14)

17) Fully supported!

18) Please check this demo:
http://blogs.telerik.com/blogs/09-02-04/Insert_Update_Delete_with_OpenAccess_and_RadGridView_for_Silverlight.aspx

19) The demo is here:
http://demos.telerik.com/wpf/?GridView/Scroll

20) Please check 1)

21) Here is an example:
xaml:
       <telerik:RadGridView Name="RadGridView1" MultipleSelect="True" 
                IsReadOnly="True" IsFilteringAllowed="False" ShowGroupPanel="False"  
                telerik:Theming.Theme="Vista"  
                SelectionChanged="RadGridView1_SelectionChanged"
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn Width="50"
                    <telerik:GridViewDataColumn.HeaderCellStyle> 
                        <Style TargetType="telerik:GridViewHeaderCell"
                            <Setter Property="Template"
                                <Setter.Value> 
                                    <ControlTemplate TargetType="telerik:GridViewHeaderCell"
                                        <CheckBox Name="HeaderCheckBox" HorizontalAlignment="Center" VerticalAlignment="Center" Click="HeaderCheckBox_Click" Loaded="HeaderCheckBox_Loaded" /> 
                                    </ControlTemplate> 
                                </Setter.Value> 
                            </Setter> 
                        </Style> 
                    </telerik:GridViewDataColumn.HeaderCellStyle> 
                    <telerik:GridViewDataColumn.CellStyle> 
                        <Style TargetType="telerik:GridViewCell"
                            <Setter Property="Template"
                                <Setter.Value> 
                                    <ControlTemplate TargetType="telerik:GridViewCell"
                                        <CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="{Binding Path=IsSelectedMode=TwoWay
                                              RelativeSource={RelativeSource FindAncestor, 
                                              AncestorType=telerik:GridViewRow}}" /> 
                                    </ControlTemplate> 
                                </Setter.Value> 
                            </Setter> 
                        </Style> 
                    </telerik:GridViewDataColumn.CellStyle> 
                </telerik:GridViewDataColumn> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 

C#
        void Window1_Loaded(object sender, RoutedEventArgs e) 
        { 
            Record record = RadGridView1.ItemsControl.Records[3]; 
            int recordIndex = RadGridView1.ItemsControl.Records.IndexOf(record); 
 
            ItemsGenerator gen = ((BaseItemsControl)(RadGridView1.ItemsControl)).ItemsGenerator; 
            GridViewRow row = (GridViewRow)gen.GenerateItemAtIndex(recordIndex); 
            row.Items.Where(i => i.Content.ToString() == "AROUT").Select(i=>i.Background = Brushes.Red).Any(); 
        } 
 
        private void HeaderCheckBox_Click(object sender, RoutedEventArgs e) 
        { 
            if (((CheckBox)sender).IsChecked == true
            { 
                foreach (Record record in RadGridView1.ItemsControl.Records) 
                { 
                    record.IsSelected = true
                } 
            } 
            else if (((CheckBox)sender).IsChecked == false
            { 
                RadGridView1.SelectedRecords.Clear(); 
            } 
        } 
 
        private void RadGridView1_SelectionChanged(object sender, SelectionChangeEventArgs e) 
        { 
            if (RadGridView1.SelectedRecords.Count == RadGridView1.ItemsControl.Records.Count) 
            { 
                if (RadGridView1.SelectedRecords.Count > 0) 
                { 
                    headerCheckBox.IsChecked = true
                } 
            } 
            else 
            { 
                if (RadGridView1.SelectedRecords.Count == 0) 
                { 
                    headerCheckBox.IsChecked = false
                } 
                else 
                { 
                    headerCheckBox.IsChecked = null
                } 
            } 
        } 
 
        private void HeaderCheckBox_Loaded(object sender, RoutedEventArgs e) 
        { 
            headerCheckBox = (CheckBox)sender; 
        } 
    } 

22) Supported - check demos!

23) Simple, Summer, Vista, Caramel, Office Black, Telerik - 6!

24) We will add such demo for our upcoming masked editor.

25) Supported.

26) Please check this post:
http://blogs.telerik.com/vladimirenchev/posts/09-02-03/Easy_programmatic_UI_customization_for_WPF_and_Silverlight.aspx

Sincerely yours,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Prash
Top achievements
Rank 1
answered on 10 Feb 2009, 11:38 AM
Hello,
I have following queries regarding the grid.

1) Is there a way to rename the cell (press F2 ). Currently the Tab movements are proper but I want that when the user has selected some cell with the Tab key then there should be some mechanism for inputting some data in the cell.

2)I went through the example of the Validation on cell level, but while validating if the validation fails i want to Highlight the cell with red border. I tried it dooing code but was not successful.

3) Can the Copy Paste functionality be achieved on mutiple cell/ Row level ?

4)Maskedtextbox, DateTimeText Box , Value Range etc. Support for RadGridView

5)On mouse move on the cell the editor for the corresponding Datatype should be visible.

6)Cell editor visible on various conditions like Always, onmouseover, mouseovercell, mouseoverrow etc

Thanks and regards
Tags
GridView
Asked by
Prash
Top achievements
Rank 1
Answers by
Prash
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or