Click here to Skip to main content
15,894,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
In wpfdataGrid from wpf tool kit i want to set IsReadOnly Property based on a condition
<wpfToolkit:DataGridTextColumn Header="quantity" Binding="{Binding Path=Quantity,Mode=TwoWay,Converter={StaticResource HODataGridN2Converter}}" Width="0.20*" ElementStyle="{StaticResource HOGridRightAlignStyle}" EditingElementStyle="{StaticResource HOGridEditRightAlignStyle}"  IsReadOnly="True" />

it's working here the quantity is not editable but if i do based on a condition
<wpfToolkit:DataGridTextColumn Header="quantity" Binding="{Binding Path=Quantity,Mode=TwoWay,Converter={StaticResource HODataGridN2Converter}}" Width="0.20*" ElementStyle="{StaticResource HOGridRightAlignStyle}" EditingElementStyle="{StaticResource HOGridEditRightAlignStyle}"  IsReadOnly="{Binding IsQuantityEditable,UpdateSourceTrigger=PropertyChanged}" />

it's not working even if I set it to true it comes always editable.
Please give me a solution for this problem.
Posted
Updated 8-Feb-11 20:08pm
v2
Comments
dasblinkenlight 9-Feb-11 22:07pm    
This looks like a binding issue. Do you see any suspicious messages in VS output window?
Vasudevan Kannan 14-Feb-11 18:26pm    
Are you sure you are setting the isquantityEditable to false in code behind or in your view model ?

1 solution

Try to create the DataGridTextColumn in code. So there you can easily set the ReadOnly property.. Example

DataGridTextColumn column=new DataGridTextColumn ();
column.Binding= "bindingName";
column.Header="Your Header";
column.IsReadOnly=True;

Best of Luck.. :-D :-D :-D
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900