This is a migrated thread and some comments may be shown as answers.

DynamicResource in Column not updating

1 Answer 325 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 04 Jul 2016, 02:23 PM

I have a GridViewColumn where the IsVisible property is connected to a DynamicResource "ShowColumn". When I click on the Button, the value of the "ShowColumn" resource is negated. While the Content of the Button is updated, the IsVisible property of the column does not change.

How can I achieve that the column is hidden/shown when the resource value changes? The mechanism is part of a larger framework, that does not support direct binding to a ViewModel as the resources are dynamically created as needed and the values are inherited from higher levels.

<Window.Resources>
    <system:Boolean x:Key="ShowColumn">True</system:Boolean>
</Window.Resources>
 
<DockPanel>
    <Button x:Name="Button" Content="{DynamicResource ShowColumn}" Click="ShowHideClick" />
    <telerik:RadGridView AutoGenerateColumns="False">
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn Header="Foo" IsVisible="{DynamicResource ShowColumn}" />
        </telerik:RadGridView.Columns>
    </telerik:RadGridView>
</DockPanel>

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 07 Jul 2016, 07:23 AM
Hello Alexander,

I'm attaching a sample project where I've followed the approach demonstrated in this helpful article to achieve the desired behavior.

Please have a look at it and let me know if it would work for you.

Regards,
Dilyan Traykov
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Alexander
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or