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

[Solved] Set IsVisible Property through Binding

3 Answers 166 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
veena
Top achievements
Rank 1
veena asked on 08 Oct 2009, 06:53 AM
Hi,

We have a xaml file in our application which uses RadGridView. It has a column called "CustomerID". This column's visibility must be set through a property depending upon a condition. I tried to set it like below:

<

 

RadGrid:GridViewColumn x:Name="CustomerID" UniqueName="CustomerID" IsVisible={Binding Path=IDVisibility}"/>

The property IDVisibility is of Boolean Type. When i tried to run the application it is showing the following error:

"AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 832 Position: 72]"

Then I changed the setting like below:

 

 

 

<Style x:Key="IDVisibilityStyle"

 

 

 

 

 

TargetType="RadGridView:GridViewCell">

 

 

 

 

 

 

<Setter Property="IsVisible" Value="{Binding Path=IDVisibility}"></Setter>

 

 

 

 

 

 

</Style>

 

 

 

<RadGrid:GridViewColumn x:Name="CustomerID" UniqueName="CustomerID" IsVisible={StaticResource IDVisibilityStyle}"/>

Now the error is like "Invalid attribute value IsVisible for property Property. [Line: 23 Position: 34]"

Please help me out in this.

Thanks in advance.
VR


3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 08 Oct 2009, 06:56 AM
Hello,

You cannot use Binding on non control objects - in this case grid columns.

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
veena
Top achievements
Rank 1
answered on 08 Oct 2009, 07:19 AM
Hi,

Thanks for the quick reply. It will be helpful if you could tell me how to achieve this. Actually the property resides in the ViewModel. (We are following MVVM pattern). The property to which IsVisible is binded is to be set in the VM depending upon a condition.

Thanks in advance
VR
0
Vlad
Telerik team
answered on 12 Oct 2009, 11:23 AM
Hello veena,

You can achieve this programmatically - Binding to properties of such elements is not supported by Silverlight 3 in general!

MS Silverlight team promised that this will be availble in Silverlight 4.

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Calendar
Asked by
veena
Top achievements
Rank 1
Answers by
Vlad
Telerik team
veena
Top achievements
Rank 1
Share this question
or