Hello experts,
i'm trying to bind IsReadOnly property on xamgrid to a boolean property on my datacontext(ViemModel).
and for some odd reason it wont bind.
i want to block and unblock the columns the editing dynamically
here is a snipet of my ViewModel
private
bool m_isReadOnly = true;
{
get { return m_isReadOnly; }
set{m_isReadOnly = value;
RaisePropertyChanged("IsReadOnly");
}
and in the xaml i do the next binding
<
ig:TextColumn HeaderText="Pressure [m]" Key="Pressure"
IsSummable="False"
IsFixable="False"
IsReadOnly="{Binding Path=IsReadOnly}">
the column can see the properties of my VM but isreadonly wont work when i change the property true/false while running.
any ideas?
Hello,
I am checking if this is still an issue for you.
If you require any further assistance please do not hesitate to ask.
Sincerely,
Ekaterina
Developer Support Engineer
Infragistics
www.infragistics.com/support
Thanks for the fast replay!
i want to use dependency object to bind the readonly property on the xamgrid,
could u please make a simple example on how to do that? both in the code and in xaml, i dont fully understand the example in the link.
thanks in advance!
great, thanks!
i made example project, not sure its gonna run, because i ripped few folders out to make it smaller, but you can look at the source code and see the classes.
thanks again!
Thank you for your project.
The “cannot resolve symbol IsReadOnly” means that the compiler do not know what is IsReadOnly. That means that either you have a typo in the property name or in the given class there is on such property. For now I assume that the reason for the binding not to succeed is the Grid’s DataContext. Have you tried passing the ViewModel class itself instead of going through the Locator – if dataContext binding of the Grid do not succeed and the ViewModel instance is not being passed correctly by the Locator, you are going to look for the IsReadOnly in the Locator itself and therefore such an error can be produced.
I will be looking forward to hearing from you.
Infragistics, Inc.
Hello Ekaterina,
thanks for the response, i did a work around like you suggested before.
i created a local static resource class in the stack panel xaml. in the code behind i find this resource, and send this instance with "mvvm light" messaging to my main viewmodel.
its work great. but now i have a new problem, i posted another thread here on the subject.
the IsReadOnly wont work until i exit "edit mode" of a row.
it just shrinks the textbox to the size of the string in it, but i can still edit it
is it a bug? or i'm doing something wrong?
I have been looking into your issue and I have created a sample project that demonstrates the complete implementation of this approach. Notice that the Proxy class is working as expected and the property is being applied successfully.
Please let me know if you have future concerns regarding the discussed matter.
Infragistics, Inc .
Hi Ekaterina,
I have same problem like hiding the xamgrid columns based on the search criteria. I am not able to open the project which you have shared. I am using VS2010.
I am following the same approach using the proxied object, but the visibility property is not working.
Could you please help me in resolving the problem and share your sample project.
Thanks
G VamshiKrishna
Hello Vamshi,
I can say that this behavior is expected and you have to clear the cache. You can do it by code, too. Here is discussed how to do so:
http://stackoverflow.com/questions/12423088/programmatically-clear-silverlight-application-storage
I have solved the visibility problem.There was some binding problem my side. But the point is like everytime before i launch my application, i need to clear the cache files. Otherwise it is not working properly. I think as we are storing the grid properties in IsolatedStorageFile, whenever i launch the application without clearing the cache, it is taking the last visibility stage.Is there any other solution ,other than clearing the cache.
Can you please help me in resolving the problem.