Bind property of view model to IsHidden via converter
Hello,
the data object in the ObservableCollection of my view model is
class Data
{
public bool IsEnabled{ get; private set;}
public float Value{get; set; }
...
}
In my view I have inside the SfDataGrid (I had to use the "(" instaed of "<" since "<" row were deleted)
(syncfusion:SfDataGrid
ItemsSource="{Binding Source={StaticResource cvsData}}"
...
>
(syncfusion:SfDataGridColumns>
...
(syncfusion:GridNumericColumn
HeaderText="Value"
DisplayBinding="{Binding Value}"
IsHidden="{Binding IsEnabled, Source={StaticResource cvsData}, Converter=BoolConverterNOT}"
...
/>
The converter negates the IsEnabled flag. The value "Value" is shown, but the IsEnabled-flag is not respected. Is there an error in binding?
the data object in the ObservableCollection of my view model is
class Data
{
public bool IsEnabled{ get; private set;}
public float Value{get; set; }
...
}
In my view I have inside the SfDataGrid (I had to use the "(" instaed of "<" since "<" row were deleted)
...
>
(syncfusion:SfDataGridColumns>
...
(syncfusion:GridNumericColumn
DisplayBinding="{Binding Value}"
IsHidden="{Binding IsEnabled, Source={StaticResource cvsData}, Converter=BoolConverterNOT}"
...
/>
SIGN IN To post a reply.
3 Replies
GT
Gnanasownthari Thirugnanam
Syncfusion Team
April 6, 2018 07:14 AM UTC
Hi Thomas,
Please find the response for your queries,
|
Query 1 : In my view I have inside the SfDataGrid (I had to use the "(" instaed of "<" since "<" row were deleted) |
We didn’t know how to used the “(“ in your application kindly revert to us with modified sample based on your application that will be helpful to provide appropriate solution at the earliest.
|
|
Query 2: The converter negates the IsEnabled flag. The value "Value" is shown, but the IsEnabled-flag is not respected. Is there an error in binding? |
We had prepared the sample based on your given code snippet but IsHidden is set properly based on ViewModel property value. For your reference we had attached the sample in below mentioned location.
Sample location: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SfDataGridDemo-1596816084
Please refer the below UG link for more details about IsHidden property.
Please refer the below KB links for more details about your requirement.
If your requirement is different from above kindly revert to us with more details about your requirement like modified sample, video or screenshot illustration that will be helpful to provide appropriate solution at the earliest.
|
Regards,
Gnanasownthari T.
TS
Thomas Schmid
April 6, 2018 07:58 AM UTC
1) When I used the "<" char at the beginning of a xml string, the complete row was deleted after saving (therefor I edited the request about 5 times and at least I used the "(" char).
2) I found the error, just a stupid one:
IsHidden="{Binding IsEnabled, Source={StaticResource cvsData}, Converter={StaticResource BoolConverterNOT}}"
2) I found the error, just a stupid one:
IsHidden="{Binding IsEnabled, Source={StaticResource cvsData}, Converter={StaticResource BoolConverterNOT}}"
SJ
Sathiyathanam Jeyakumar
Syncfusion Team
April 9, 2018 07:24 AM UTC
Hi Thomas,
Thank you for the update.
We are happy to know that you have achieved your requirement. Please let us know if you need any further assistance on this.
Regards,
Sathiyathanam J.
Thank you for the update.
We are happy to know that you have achieved your requirement. Please let us know if you need any further assistance on this.
Regards,
Sathiyathanam J.
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
TS Thomas Schmid
- Apr 5, 2018 07:42 PM UTC
- Apr 9, 2018 07:24 AM UTC