<telerik:GridViewDataColumn Width="Auto" DataMemberBinding="{Binding AbstractionTarget}" IsVisible="{Binding IsMemberLevel}"
Why is this no longer a Dependency Property? It does not make sense to cause backward compatibility issues when it can be completely avoided.
15 Answers, 1 is accepted
I am not sure that I can understand your problem. I have tested your scenario using our latest official version - 2014.2.0729 and the binding is working as expected. Please check the attached project for a reference.
Regards,
Yoan
Telerik
You are binding to a UI element not the ViewModel.
I have updated the sample project. Now the IsVisible property of the column and the IsChecked property of the CheckBox are bound to a property from ViewModel. Please give it a try and let me know how it works for you.
Regards,
Yoan
Telerik
In the previous versions the data template for the hierarchy child grid could be bound to the view model. This no longer works and is preventing us from moving our enterprise solution to the latest version of Telerik for WPF.
We need this fixed.
<Grid.Resources>
<DataTemplate x:Key="RowDetailsTemplate">
<telerik:RadGridView Name="playersGrid"
ItemsSource="{Binding Players}"
AutoGenerateColumns="False">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Number}" IsEnabled="{Binding IsActive}"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Position}" IsVisible="{Binding IsActive}"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Country}"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</DataTemplate>
</Grid.Resources>
In order to resolve your problem, may I ask you which version of Telerik UI for WPF you are using?
I'm looking forward to hearing from you.
Regards,
Yoan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
I have prepared a sample project using the 2014.1.331.45 version of our controls. Please note that the code snippet you provided does not work with the mentioned version. You can notice the binding errors in the Output windows. In order to resolve them, you can specify a valid Source for the binding:
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Number}"
IsEnabled
=
"{Binding IsActive,Source={StaticResource MyViewModel}}"
/>
Please check the sample project and let me know if I am missing something.
Regards,
Yoan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Perhaps you misunderstand the problem. Our code works perfectly with the version I mentioned. It does not work with the latest version 2014.2.0729.
This code you posted is an example of a binding to IsEnabled. We are talking about IsVisible in this thread. Please show me an example of a project where the above code I posted actually works with the latest version of Telerik WPF.
This bug is causing us a tremendous amount of productivity loss because this change means we cannot use the latest version of the property grid and we have been having to do work several work around pending resolution to this issue.
Please excuse me for not posting the correct code snippet. However, I have used the correct one in the attached sample project from 17 October (it is the same as your code snippet from 13 October ). Unfortunately, there was a problem with our system and the sample project was not visible in the public forum. I have attached it again in this reply. The sample project does not work as expected even with 2014.1.331.45 version of our controls.
As it turns out, we have similar bug which is already logged in our bug tracking system. It is reproducible since 2014.2.0729, so I believe the issue is the same. You can check the progress of the issue in our Feedback Portal: GridViewColumn.DataContext is not inherited. You can also follow the item in the feedback portal. That way you will get a notification every time its status get changed.
Regards,
Yoan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Here is a link to the sample project http://1drv.ms/1pZspqc
This is causing us to cancel a release until these issues are resolved either with a patch or another release.
Issue List:
1)
IsVisible binding
works on the parent grid but not on the child /hierarchy grid.
2)
When we sort on the
columns, we get an exception because of the <Setter Property="IsExpanded" Value="True"
/>
All the above issues did
not exist with our previous Telerik version , once we upgraded to 2014.3.1021.45 we are
having all sorts of issues. I have attached the working codebase along with
this email(zip).
Code:-
<Window x:Class="LatestVersionIssues.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:my="clr-namespace:LatestVersionIssues"
Title="MainWindow" Height="350" Width="525" >
<Window.DataContext>
<my:MainViewModel/>
</Window.DataContext>
<Grid>
<telerik:RadGridView Grid.Row="0"
Name="clubsGrid"
ItemsSource="{Binding Clubs}"
AutoGenerateColumns="False"
Margin="5">
<telerik:RadGridView.Columns>
<!--IsVisible property on the parent grid is
working-->
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" IsVisible="{Binding IsActive}"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Established}"
Header="Est."
DataFormatString="{}{0:yyyy}"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding StadiumCapacity}"
Header="Stadium"
DataFormatString="{}{0:N0}"/>
</telerik:RadGridView.Columns>
<telerik:RadGridView.ChildTableDefinitions>
<telerik:GridViewTableDefinition />
</telerik:RadGridView.ChildTableDefinitions>
<telerik:RadGridView.HierarchyChildTemplate>
<DataTemplate>
<telerik:RadGridView Name="playersGrid"
ItemsSource="{Binding Players}"
AutoGenerateColumns="False">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Number}" />
<!--IsVisible property on the
child/hierarchy grid is not working-->
<telerik:GridViewDataColumn DataMemberBinding="{Binding Position}" IsVisible="{Binding IsActive}"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Country}"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</DataTemplate>
</telerik:RadGridView.HierarchyChildTemplate>
<!--The below setter causes issue
while sorting-->
<telerik:RadGridView.RowStyleSelector>
<telerik:ConditionalStyleSelector>
<telerik:StyleRule Condition="IsOpen =
True">
<Style TargetType="telerik:GridViewRow">
<Setter Property="IsExpanded" Value="True" />
</Style>
</telerik:StyleRule>
</telerik:ConditionalStyleSelector>
</telerik:RadGridView.RowStyleSelector>
</telerik:RadGridView>
</Grid>
</Window>
Thanks
Thank you for isolating the problem in a demo project. Running it, I was able to reproduce both the reported issues.
As to the exception, generally we do not recommend working with the visual elements in RadGridView (i.e. GridViewRow) as it is a virtualized control and its elements are reused as they are brought in and out the view area. You can check our online documentation explaining how the UI virtualization works.
We will investigate the case further and contact you back with more information.
Regards,
Dimitrina
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
I managed to investigate the case a bit further.
As I already informed you I reproduced the problem with IsVisible property's Binding running the demo project against the latest version. I also tested it with the old version when you state it was working fine:
2014.1.331.45 (in your post from 15-Oct-2014). I also tested with version: 2014.1.224.45.
The result I observed:
The column Position (in the hierarchy RadGridView) was still visible no matter of the value of IsActive property. The demo behaves the same way with any of those three versions.
Am I missing anything I need to do in addition when testing?
As to the particular implementation, I have two comments:
1. The DataContext of the main (parent) RadGridView is the DataContext of the Window (i.e. MainViewModel). As the IsActive property is a property of the MainViewModel it is correctly resolved by the Binding in the main RadGridView.
2. The DataContext of the hierarchy (child) RadGridView is the item behind the parent GridViewRow (i.e. Club). As it does not expose IsActive property, the value cannot be resolved by the binding. In case the Binding cannot be correctly resolved, you can try defining your ViewModel as a StaticResource and then set it as a Source for the Binding. You can also check the Binding.Source Property as a reference.
For example:
<
Window.Resources
>
<
my:MainViewModel
x:Key
=
"MyViewModel"
/>
</
Window.Resources
>
<
Grid
DataContext
=
"{StaticResource MyViewModel}"
>
...
<
telerik:GridViewDataColumn
DataMemberBinding
=
"{Binding Position}"
IsVisible
=
"{Binding IsActive, Source={StaticResource MyViewModel}}"
/>
That way the Position column should be visible or not depending on the value of the IsActive property.
Would you please check this and let me know the result?
Regards,
Dimitrina
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
I am writing back to inform you as to the exception related to the reported problem #2. As it turns out this was indeed a bug and fortunately it was resolved with our latest version. You can download the latest internal build from your account and try with it.
For your convenience, I updated the test project and attached it back for a reference.
Regards,
Dimitrina
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
You can download the latest internal build after you log in into your account and navigate to: http://www.telerik.com/account/your-products/internal-builds.aspx
Then select the product UI for WPF and you will see the last two internal builds available for download. The direct link is:
Telerik_UI_for_WPF_2014_3_1117_DEV_hotfix
Regards,
Dimitrina
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.