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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DataGrid Template Column Binding to Commands

Thread ID:

Created:

Updated:

Platform:

Replies:

114405 Nov 18,2013 08:33 PM UTC Nov 21,2013 06:24 AM UTC WinRT 1
loading
Tags: SfDataGrid
Richard Noake
Asked On November 18, 2013 08:33 PM UTC

Hi I have a GridTemplateColumn in a DataGrid into which I have a Button. In principle I have a column which may or may not have notes in it. I show a button to indicate a note and if there is a note I intend the user can click the button to show / edit the note. The Cell Template is shown below.

<syncfusion:GridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Content="" Visibility="{Binding Note,Converter={StaticResource stringToVisibilityConverter}}" 
                                    Margin="0,0,12,0"
                                    BorderBrush="Transparent"  FontFamily="Segoe UI Symbol" 
                                    FontSize="30" Foreground="Gold" 
                                    HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </DataTemplate>
                    </syncfusion:GridTemplateColumn.CellTemplate>

When I try and bind the button to a command the binding fails as it is looking within the Type which is bound to each row rather than the parent data context. What is the best way to achieve this?

Narayanasamy J [Syncfusion]
Replied On November 21, 2013 06:24 AM UTC

Hi Richard,

Thank you for using Syncfusion products,

We have analyzed your query. . You need to specify Source Property for Binding explicitly in UIElement.Visibility property to achieve your requirement. Please find the code snippet below for your reference:

Code Snippet:

 

<Button Content="[]" Visibility="{Binding Note,Source={StaticResource viewModel}}" Height="50"  Width="100"/>

         

Please let us know if you need further assistance.

Regards,

Narayanasamy.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;