Binding Visible for FlexGrid Column

Posted by: trancuong200495 on 25 December 2017, 12:36 am EST

    • Post Options:
    • Link

    Posted 25 December 2017, 12:36 am EST

    I want to binding Visible in c1:Column to a boolean value but it doesn’t work because Visible isn’t DependencyProperty and c1:Column isn’t DependencyObject so i cant create attached property for it.I tried to create a celltemplate and binding all controls inside it to collapse but it only hide content of the column not the whole column. Is there any way to solve this

    <c1:C1FlexGrid ItemsSource="{Binding Persons}" AutoGenerateColumns="False">
            <c1:C1FlexGrid.Columns>
                <c1:Column>
                    <c1:Column.CellTemplate>
                        <DataTemplate>
                            <TextBlock Visibility="{Binding Visible,Converter={StaticResource booleanToVisibilityConverter}}" Text="{Binding First}"/>
                        </DataTemplate>
                    </c1:Column.CellTemplate>
                </c1:Column>
    
                <c1:Column Visible="{Binding Visible}" Binding="{Binding Last}"></c1:Column>
                <c1:Column Visible="True" Binding="{Binding CountryID}"></c1:Column>
                <c1:Column Binding="{Binding Active}"></c1:Column>
                <c1:Column Binding="{Binding Hired}"></c1:Column>
            </c1:C1FlexGrid.Columns>
        </c1:C1FlexGrid>
    
  • Posted 26 December 2017, 6:20 am EST

    Hello,

    Binding the visible property of a column is not directly possible. So, if you are not using the MVVM pattern, then we suggest you to change the column visibility in code-behind.

    Thanks,

    Ruchir Agarwal

  • Posted 26 December 2017, 3:07 pm EST

    Hi Ruchir Agarwal

    The point is I’m using MVVM pattern so I must find a way to bind Visible for FlexGrid Column

    Thanks

  • Posted 26 December 2017, 8:08 pm EST

    Hi,

    Please note, this is the limitation of C1FlexGrid that we cannot bind the Visible property of a column because this is not a DependancyProperty also cannot add a new property for the same purpose in Column class because it cannot be derived from DependencyObject.

    So that your requirement can only be achieved to set the column’s visible property based on your requirement in the code base.

    Hope, it clarifies for you.

    Thanks,

    Singh

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels