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

Cannot hide GridViewSelectColumn through Property Binding

6 Answers 167 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Vamsi
Top achievements
Rank 1
Vamsi asked on 26 Apr 2013, 03:31 PM

I am using Silveright MVVM .

I have a RadGridView, which has another RadGridView as RowDetails and I have a GridViewSelectColumn for the row details. I want to set the visibility of the column with "IsVisible" to false. When I directly set the values in xaml It works fine. But When I do it through Property Binding  though ViewModel it does not work.

Looks like a telerik issue to me. I have isloated the Bug in a seperate project but I forum doesnot let me upload the project to the thead.  

6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 26 Apr 2013, 03:50 PM
Hi Vamsi,

DataContext of the RowDetails is their corresponding item. So, if the property you bound the visibility of the column to is a part of it, it should work without any troubles. However, if the property is defined in your ViewModel for example, the binding will not work and you will most probably get binding errors in your output window. If the later is your case, you need to specify the Source of the binding explicitly. For example:
IsVisible="{Binding MyIsVisibleProperty, Source={StaticResource MyViewModel}}"

 

Regards,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Vamsi
Top achievements
Rank 1
answered on 26 Apr 2013, 03:55 PM
No, I have my Property in the Entity collection bound to the parent Grid.
Taking club and Players as an Example.

Club is the Parent RowItem, and It has a property "CanSelectPlayers" which is bound to IsVisible property of the Players RowDetail Item.

0
Vamsi
Top achievements
Rank 1
answered on 26 Apr 2013, 05:15 PM
I have Isolated the Issue, let me know where can I upload the project
0
Maya
Telerik team
answered on 26 Apr 2013, 05:28 PM
Hello Vamsi,

Generally, you can open a support ticket and attach the project there. However, I believe I manage to reproduce the issue you reported - I just exposed a property for the Club - CanSelectPlayers and bind bound it to the IsVisible property of the column in the inner grid:

<DataTemplate x:Key="RowDetailsTemplate">
              <telerik:RadGridView Name="playersGrid"
                                   ItemsSource="{Binding Players}"
                                   AutoGenerateColumns="False">
                  <telerik:RadGridView.Columns>
                      <telerik:GridViewSelectColumn IsVisible="{Binding CanSelectPlayers}" />
                      <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/>
                      <telerik:GridViewDataColumn DataMemberBinding="{Binding Number}"/>
                      <telerik:GridViewDataColumn DataMemberBinding="{Binding Position}"/>
                      <telerik:GridViewDataColumn DataMemberBinding="{Binding Country}"/>
                  </telerik:RadGridView.Columns>
              </telerik:RadGridView>
          </DataTemplate>

Is that your scenario ? 

Greetings,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Vamsi
Top achievements
Rank 1
answered on 26 Apr 2013, 05:32 PM
Perfect, That is the Scenerio. And the weird behaviour I see is , When I check on check box of the first row, thats when the column disappears.
0
Maya
Telerik team
answered on 26 Apr 2013, 09:20 PM
Hi Vamsi,

Indeed, I managed to get the same behavior. I will investigate it and let you know once I know more about what is causing it.  

Greetings,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Vamsi
Top achievements
Rank 1
Answers by
Maya
Telerik team
Vamsi
Top achievements
Rank 1
Share this question
or