Set IsVisible Property through Binding

4 posts, 0 answers
  1. veena
    veena avatar
    32 posts
    Member since:
    Mar 2009

    Posted 08 Oct 2009 Link to this post

    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


  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 Oct 2009 Link to this post

    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.
  3. DevCraft banner
  4. veena
    veena avatar
    32 posts
    Member since:
    Mar 2009

    Posted 08 Oct 2009 Link to this post

    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
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 12 Oct 2009 Link to this post

    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.
Back to Top