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

vertical cell joining

3 Answers 116 Views
GridView
This is a migrated thread and some comments may be shown as answers.
marc
Top achievements
Rank 1
marc asked on 17 Nov 2011, 01:28 PM
my customer would like to have a visual indicator, when vertical cells contain the same value. I've found a way to get it to work basically but some of my code looks pretty awfull.

<DataTemplate x:Key="Group_GridCellTemplate">
        <Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <style:CRowJoiner Template="{StaticResource MM_RJI}">
                    <style:CRowJoiner.DataContext>
                        <MultiBinding Converter="{StaticResource RJ}">
                            <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewCell}}" Path="Column" />
                            <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewCell}}" Path="ParentRow" />
                            <Binding RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewCell}}" Path="Value" />
                        </MultiBinding>
                    </style:CRowJoiner.DataContext>
                </style:CRowJoiner>
                <ContentControl Grid.Column="1" Content="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewCell}}, Path=Value}" ContentTemplateSelector="{StaticResource GCTS}" />
            </Grid>
        </Grid>
    </DataTemplate>

as you can see i am using the gridviewcell extensively. is it possible to simply pass the gridviewcell as a whole to a converter? currently i am passing 3 properties from the same object and thats just stupid. my converter uses the information provided to do the cell joining, its not exactly simple though.

3 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 17 Nov 2011, 02:03 PM
Hi Marc,

That is an interesting hack . Unfortunately passing the whole cell is inappropriate as with RadGridView while scrolling cells are being reused . With your current approach you will have notifications on a property change for all 3 properties you use. In the case with the cell , you will lose that and the results may become unpredictable while the user scrolls vertically or horizontally .

Best wishes,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
marc
Top achievements
Rank 1
answered on 30 Nov 2011, 07:15 PM
Hi Pavel,
you are soooo correct. I am noticing a strong drop in performance with larger tables, because of turning off virtualisation. turning it back on results in absolutely unpredictable results in my cells. I was wondering if there is a way to get a list of the sorted rows from the telerik grid. if not I will have to emulate the sorting behaviour of the grid. I guess I will then have to go throgh the sorted rows and update some background data that can be used for updating the cells. seems kind of complicated (not that my first approach was simple...).

What would your approach be?
0
marc
Top achievements
Rank 1
answered on 10 Jan 2012, 11:32 AM
I have found a solution to my problem, but it is not really pleasing to me. I need to be able to identify the Column name using the Cell. To achieve this I am currently storing the Column Name within the Object being displayed in the cell. This works fine, but I don't like it, as it makes things more complicated. Is there any way to get the column name safely from the cell? I am already using a converter, so code behind is fine for me.
Tags
GridView
Asked by
marc
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
marc
Top achievements
Rank 1
Share this question
or