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

Binding for "IsVisible" does not work

1 Answer 360 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Richard Koslik
Top achievements
Rank 1
Richard Koslik asked on 03 Nov 2010, 08:37 AM
Hello!

I have a RadGridView and want to display the columns dynamically, so I use a Databinding for my variable in the ViewModel.

<telerik:RadGridView ShowColumnHeaders="False" AutoGenerateColumns="False" 
                     IsBusy="{Binding bIsDataLoading}" 
                     SelectedItem="{Binding SelectedDataItem,Mode=TwoWay}" 
                     ItemsSource="{Binding tab_Data}" Name="grdOverview"  
                     HorizontalAlignment="Left" VerticalAlignment="Top" 
                     Width="640" Height="350" Margin="0,50,0,0">
   <telerik:RadGridView.Columns>
       <telerik:GridViewDataColumn IsVisible="{Binding bsColumn1}"  
                DataMemberBinding="{Binding S1}" Width="{Binding iWidthsColumn1}" />
       <telerik:GridViewDataColumn IsVisible="{Binding bsColumn2}" 
                DataMemberBinding="{Binding S2}" Width="{Binding iWidthsColumn2}" />
       <telerik:GridViewDataColumn IsVisible="False" 
                DataMemberBinding="{Binding S3}" Width="{Binding iWidthsColumn3}" />
   </telerik:RadGridView.Columns>
</telerik:RadGridView>

In the ViewModel I initialize for example "S2=false" and call then "this.OnPropertyChanged(p => p.S2)" for my variable. After that I show the window with the GridView, but the column is still displayed! When I click onto the column the first time the data is deleted, when I click a second time the data gets visible. It looks crazy! If I set the property "IsVisible=false" without a binding the column is not shown and it works.

I have included a screenshot of my gridview.

Maybe I am missing something, so that it works.

Best regards, Richard

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 08 Nov 2010, 05:44 PM
Hi Richard Koslik,

You may take a look at this forum thread for a reference. 

Kind regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Richard Koslik
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or