iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi Guys,
We are currently experiencing issues with the attributes for Enabled and Visibility bindings. These attributes work on initial load of the View; however, when you change the value of the property/field that is bound to the Section or Element the bindings are NO longer working. How do you notify the attributes that the property/field bound to it has changed and that the view needs to be notified of the changes as well?
Nevermind, we've managed to make it work using a property/field from the viewmodel. Using the same setup with "IsNewItem" from the ItemEditorViewModel. Here's the attribute setup.
[EnabledBinding(Path = "EnableEntries", SourceType = BindingSourceType.ViewModel, ConverterType = typeof(BooleanConverter))]
Hope others will find it useful. Thanks!
P.S. Although this worked, the fact remains that using a property/field from the item model doesn't. Or we could be missing something, and this should still remain an open case.
I'm using MyInventory sample project as reference for your reported problem. First, please find Item.FormMetadata.cs file in the MyInventory.Core/Models.
The SoldDate property - marked with VisibilityBinding attribute -, is bound to a boolean property named IsSold. Could you please confirm whether you are binding the property to a boolean value?
Yes, we are using a boolean type. These bindings do work initially. But once the values are changed, the view is not being notified. Primarily, we are using EnabledBinding, can you try that as well and confirm if its working on your end.
In addition to this, we are setting the property value of this.Item.EnableEntries property from the ItemEditorViewModel, not from ItemListViewModel. Basically, setting the property value from ItemListViewModel does work before loading the ItemEditorViewModel because it has not been loaded yet.
I created a test project; and use EnabledBinding and VisibilityBinding feature where the SourceType is set to Model or ViewModel.
Following snippet code shows the summary of how to use these features in a section.
public class SoldSection{ // EnabledBinding with SourceType is set to ViewModel [Editor(EditorType.Switch)] [Display(Caption = "EnabledBinding to VM")] [Binding(Path="IsSold", SourceType=BindingSourceType.ViewModel)] public static bool IsSold; [Display(Caption = "Sold Date")] [Editor(EditorType.Date)] [EnabledBinding(Path = "IsSold", SourceType = BindingSourceType.ViewModel)] [Binding(StringFormat = "{0:d}")] public static DateTime SoldDate; // End of EnabledBinding with SourceType is set to ViewModel // EnabledBinding with SourceType is set to Model [Editor(EditorType.Switch)] [Display(Caption = "EnabledBinding to M")] public static bool IsSold2; [Display(Caption = "Sold Date2")] [Editor(EditorType.Date)] [EnabledBinding(Path = "IsSold2", SourceType=BindingSourceType.Model)] [Binding(StringFormat = "{0:d}")] public static DateTime SoldDate2; // End of EnabledBinding with SourceType is set to Model // VisibilityBinding with SourceType is set to ViewModel [Editor(EditorType.Switch)] [Display(Caption = "VisibilityBinding to VM")] [Binding(Path = "IsSold3", SourceType = BindingSourceType.ViewModel)] public static bool IsSold3; [Display(Caption = "Sold Date3")] [Editor(EditorType.Date)] [VisibilityBinding(Path = "IsSold3", SourceType = BindingSourceType.ViewModel)] [Binding(StringFormat = "{0:d}")] public static DateTime SoldDate3; // End of VisibilityBinding with SourceType is set to ViewModel // VisibilityBinding with SourceType is set to Model [Editor(EditorType.Switch)] [Display(Caption = "VisibilityBinding to M")] [Binding(Path="IsSold4", SourceType=BindingSourceType.Model)] public static bool IsSold4; [Display(Caption = "Sold Date4")] [Editor(EditorType.Date)] [VisibilityBinding(Path = "IsSold4", SourceType=BindingSourceType.Model)] [Binding(StringFormat = "{0:d}")] public static DateTime SoldDate4; // End of VisibilityBinding with SourceType is set to Model }
Hope this helps.
Hi Yudi,
Thanks for your reply. However, this issue has already been resolved. We've opened a new thread regarding VisibilityBinding for sections, not the individual properties.
Thanks!
The VisibilityBinding for sections problem has been forwarded to Crosslight development team to be investigated further. I will update the result on the "How to Use Crosslight v2 to Show/Hide Form Sections" thread.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname