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

DataTrigger issues

I have datatrigger issues. For some reason the binding seems to not be propagated inside the cell template at all.

 <syncfusion:GridDataVisibleColumn HeaderText=" " MappingName="Locked" Width="40" AllowResize="False"  AllowDrag="False" AllowSort="False" AllowGroup="False" AllowFilter="False" ShowAdvanceFilteringOptioninExcelLikeFiltering="False" ShowSearchOptioninExcelLikeFiltering="False" ShowSortOptioninExcelLikeFiltering="False">
     <syncfusion:GridDataVisibleColumn.CellItemTemplate>
        <DataTemplate>
            <Grid Height="40" Visibility="Visible">
                <Grid.Style>
                    <Style TargetType="Grid">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=Locked}" Value="False">
                                <Setter Property="Visibility" Value="Hidden" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Path=Locked}" Value="True">
                                <Setter Property="Visibility" Value="Visible" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Grid.Style>
                                          
                <Image Source="{StaticResource Image_SecurityLock}" Height="30" Width="30" />                  
            </Grid>
        </DataTemplate>
    </syncfusion:GridDataVisibleColumn.CellItemTemplate>
</syncfusion:GridDataVisibleColumn>      
for data rigger binding i have tried {binding} without success either, tried simply making instead of a grid a textblock with text and the visibility attached to {binding , converter{staticressourceBoolToVisibilityConverter}} AND {binding path=Locked, converter{staticressourceBoolToVisibilityConverter}} and my converter is not event hit. but the image display so it does get to it.

Anyone managed to make it work ? I have bunch of datatrigger that works perfectly except this control. FYI if you change the control to the basic WPF datagrid it works perfectly.

Also i am having alot of problem finding how to put NO header text and the only way i found if o put a space in the headertext property which is not convenient at all.

3 Replies

SC Saravanan C Syncfusion Team April 7, 2014 11:38 AM UTC

Hi Francis,

 

Thank you for contacting Syncfusion support,

 

It’s working as expected for us. Please find the code snippet and sample below,

 

<Grid>

    <syncfusion:GridDataControl AutoPopulateColumns="False" ItemsSource="{Binding Path=Visiblecollection}">

        <syncfusion:GridDataControl.VisibleColumns>

            <syncfusion:GridDataVisibleColumn HeaderText=" "

                                            MappingName="Check"

                                            Width="40"

                                            AllowResize="False" 

                                            AllowDrag="False"

                                            AllowSort="False"

                                            AllowGroup="False"

                                            AllowFilter="False"

                                            ShowAdvanceFilteringOptioninExcelLikeFiltering="False"

                                            ShowSearchOptioninExcelLikeFiltering="False"

                                            ShowSortOptioninExcelLikeFiltering="False">

                <syncfusion:GridDataVisibleColumn.CellItemTemplate>

                    <DataTemplate>

                        <Grid Height="40" Visibility="Visible">

                            <Image Name="image11" Source="Images\Produce.jpg"/>

                        </Grid>

                        <DataTemplate.Triggers>

                            <DataTrigger Binding="{Binding Path=Record.Data.Check}" Value="False">

                                <Setter TargetName="image11"  Property="Visibility" Value="Hidden"/>

                            </DataTrigger>

                            <DataTrigger Binding="{Binding Path=Record.Data.Check}" Value="True">

                                <Setter TargetName="image11"  Property="Visibility" Value="Visible"/>

                            </DataTrigger>

                        </DataTemplate.Triggers>

                    </DataTemplate>

                </syncfusion:GridDataVisibleColumn.CellItemTemplate>

            </syncfusion:GridDataVisibleColumn>

        </syncfusion:GridDataControl.VisibleColumns>

    </syncfusion:GridDataControl>

</Grid>

        

Please find the sample in the following location:

 

Sample: http://www.syncfusion.com/uploads/user/directTrac/122901/DataTriggerBinding954512639.zip

 

For empty HeaderText there is no other way only way is put space.

 

Regards,

Saravanan C



FR Francis Rouleau April 7, 2014 12:51 PM UTC

I have no clue where this Record.Data come from but it works.



SM Saravanan M Syncfusion Team April 14, 2014 12:22 PM UTC

Hi Francis,

Thanks for your update,

We have Record property for each cell. We have internally set Datacontext for each cell as GridDataCellBoundWrapper class which has the Record property and we are inheriting GridCellBoundWrapper class which has the property like CellBoundValue and Style.

Please let us know if you have any queries,

Regards,

Saravanan.M

 


Loader.
Up arrow icon