We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Setting cell comments on GridDataControl does not seem to work

Hi,

I want to set cell comments on a grid control.  As a test, I set the Comment property on the GridDataColumnStyle as follows:

 <syncfusion:GridDataVisibleColumn MappingName="Address" Width="100">
                    <syncfusion:GridDataVisibleColumn.ColumnStyle>
                        <syncfusion:GridDataColumnStyle Comment="TEST!">                          
                        </syncfusion:GridDataColumnStyle>
                    </syncfusion:GridDataVisibleColumn.ColumnStyle>
                </syncfusion:GridDataVisibleColumn>

And when I run the application, I see the red triangle indicator on each cell indicating that there is a cell comment, however when I hover over the cell nothing happens.

How do I properly set the comment on a grid cell and get it to display correctly? I have attached example project where the Comment property is set but at runtime I am not able to see the comments.

Any help would be appreciated. 

Thanks!
Sean



Attachment: WpfTest_d4d4ee54.zip

3 Replies

MA Mahendran Annamalai Syncfusion Team December 23, 2014 06:57 AM UTC

Hi Sean,

 

Thank you for contacting syncfusion support.

 

We have analyzed your query. You can use Comments in GridDataControl by setting ShowComment property as true in GridCommentServices. Please refer the below code snippet.

 

Code Snippet:

 

<syncfusion:GridDataControl

            ShowAddNewRow="False"

            syncfusion:GridCommentService.ShowComment="True"

            ItemsSource="{Binding Data}"

            AutoPopulateColumns="False"

            Grid.Row="0">

 

Please find modified sample from below location.

 

Sample:

 

Thanks,

Mahendran.


Attachment: WpfTest_a7a9d2ca.zip


SA Sean A December 23, 2014 03:20 PM UTC

Hi Mahendran,
 
Thanks. This indeed does get the Comment property to show on the grid.
 
However, my next logical step would be to bind this property to my view model, but it appears the Comment property cannot be bound to.
 
I get the following error when I try something like this - Comment="{Binding ZipCode}:
 
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: A 'Binding' cannot be set on the 'Comment' property of type 'GridDataColumnStyle'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.
 
How can I use this Comment property to bind or set to values for each item in my grid?
 
Thanks!
Sean
 
 


MA Mahendran Annamalai Syncfusion Team December 26, 2014 04:23 AM UTC

Hi Sean,

 

Thank you for your update.

 

We have analyzed your query, you can display every cell value as comment by using CommentTemplateKey  for that particular column. By customizing DataTemplate you can achieve your requirement. Please refer the below codesnippet.

 

Code snippet:

<Window.Resources>

        <DataTemplate x:Key="commenttext" >

            <StackPanel Background="Red">

                <TextBlock x:Name="txtblck" Text="{Binding Path=CellValue}"/>

            </StackPanel>

        </DataTemplate>

    </Window.Resources>

<syncfusion:GridDataControl Name="syncgrid">

<syncfusion:GridDataVisibleColumn MappingName="CustomerName"  >

                    <syncfusion:GridDataVisibleColumn.ColumnStyle>

                        <syncfusion:GridDataColumnStyle CommentTemplateKey="commenttext"               Comment="test" >

                        </syncfusion:GridDataColumnStyle>

                    </syncfusion:GridDataVisibleColumn.ColumnStyle>

                </syncfusion:GridDataVisibleColumn>

</syncfusion:GridDataControl>

 

Please let us know if you have any queries.

 

Thanks,

Mahednran.


Attachment: GDC_CommentSample_d25313d2.zip

Loader.
Live Chat Icon For mobile
Up arrow icon