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.

DataTrigger issues

Thread ID:

Created:

Updated:

Platform:

Replies:

116094 Apr 1,2014 09:55 AM Apr 14,2014 08:22 AM WPF 3
loading
Tags: GridDataControl
Francis Rouleau
Asked On April 1, 2014 09:55 AM

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.

Saravanan C [Syncfusion]
Replied On April 7, 2014 07:38 AM

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


Francis Rouleau
Replied On April 7, 2014 08:51 AM

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


Saravanan M [Syncfusion]
Replied On April 14, 2014 08:22 AM

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

 


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.

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.

;