Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
Xamgrid textcolumn not working in readonly mode
posted

I have one xamgrid in which i have textcolumn.I want to make it readonly depending on whether grid is in Edit mode or Viewmode.

I have viewmodel and it is not possible to have parameterless constructor in this viewmodel.so we can not use static resource for this.

i have one property called as ReadonlyMode in viewmodel which i want to bind to this textcolumn.

But on xamgrid the itemsource which is bound is collection of table from database.

So i can't place my property inside this collection.We are entity framework for getting data.

How can we do this?I tried to use relativesouce in my binding but it doesn't work.

<ig:XamGrid x:Name="InstanceGrid"
AutoGenerateColumns="False"
ItemsSource="{Binding PackageTemplateTrees, Mode=TwoWay}">

 <ig:XamGrid.Columns>

<ig:TextColumn HeaderText="Name"
HeaderTextHorizontalAlignment="Center"
Key="Name"
Width="Auto"
IsReadOnly="{Binding EditMode,Mode=TwoWay, Source={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"
MinimumWidth="150">

</ig:XamGrid.Columns>
</ig:XamGrid>

Parents
No Data
Reply
  • 138253
    Offline posted

    Hello Rakesh,

     

    Thank you for your post. I have been looking into and it seems like that the only way to bind the XamTextColumn’s IsReadOnly Property is to bind it to a static resource. If I think of another possible solution for this I will let you know.

Children
No Data