- Home
- Forum
- Xamarin.Forms
- IsVisibleProperty Binding not Working
IsVisibleProperty Binding not Working
I have a SFExpander with a Grid as its content.
The Page also has a SFDataForm on it.
Based on the selection of one of the fields in the form I am trying to make the expander visible or not.
The field source of the IsVisible target binding is DisplayDependents and is set in the DataFormItemManager SetValue method based on the value of a picker field.
The following code is a snippet of the view.
However when the SFExpander does not show when DisplayDependents is set to true in Set Value.
var layout = new StackLayout
{
Margin = new Thickness(10, 20, 10, 20),
Spacing = 5,
};
policyForm.DataObject = _vm.InsurancePolicy;
// policy info
var policyHeader = new Grid()
{
RowDefinitions =
{
new RowDefinition {Height = new GridLength(1, GridUnitType.Star) },
},
ColumnDefinitions =
{
new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star) },
},
BackgroundColor = Color.FromHex(HJHexColors.HJBlack),
Children =
{
new Label()
{
Text = "Policy Information",
TextColor = Color.FromHex(HJHexColors.HJWhite),
Margin = new Thickness(5),
}
}
};
var policyContent = new Grid()
{
RowDefinitions =
{
new RowDefinition {Height = new GridLength(1, GridUnitType.Star) },
},
ColumnDefinitions =
{
new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star) },
},
BackgroundColor = Color.FromHex(HJHexColors.HJGray),
Children =
{
policyForm,
}
};
layout.Children.Add(new SfExpander()
{
Header = policyHeader,
Content = policyContent,
HeaderIconPosition = IconPosition.End,
Margin = new Thickness(5),
HeaderBackgroundColor = Color.FromHex(HJHexColors.HJBlack),
IconColor = Color.FromHex(HJHexColors.HJWhite),
IsExpanded = true,
});
// dependent info
var dependentHeader = new Grid()
{
RowDefinitions =
{
new RowDefinition {Height = new GridLength(1, GridUnitType.Star) },
},
ColumnDefinitions =
{
new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star) },
},
BackgroundColor = Color.FromHex(HJHexColors.HJBlack),
Children = {
new Label()
{
Text = "Add Dependents",
TextColor = Color.FromHex(HJHexColors.HJWhite),
Margin = new Thickness(5),
}
}
};
var dependentExpander = new SfExpander()
{
Header = dependentHeader,
Content = MakeDependentGrid(),
HeaderIconPosition = IconPosition.End,
Margin = new Thickness(5),
HeaderBackgroundColor = Color.FromHex(HJHexColors.HJBlack),
IconColor = Color.FromHex(HJHexColors.HJWhite),
IsExpanded = true
};
layout.Children.Add(dependentExpander);
dependentExpander.BindingContext = BindingContext;
var test = dependentExpander.BindingContext;
dependentExpander.SetBinding(IsVisibleProperty, "DisplayDependents");
SIGN IN To post a reply.
2 Replies
SS
SaiGanesh Sakthivel
Syncfusion Team
March 30, 2020 12:50 PM UTC
Hi Tjismh,
Thank you for contacting Syncfusion support.
We have validating the reported issue “IsVisibleProperty Binding not Working” from our end. We are currently working on it and update you further details on April 1, 2020. We appreciate your patience until then.
Regards,
SaiGanesh Sakthivel
SS
SaiGanesh Sakthivel
Syncfusion Team
March 31, 2020 02:36 PM UTC
Hi Tjismh,
Thank you for the patience.
We have checked the reported issue “IsVisibleProperty Binding not Working” from our end. We would like to inform that you can achieve your requirement by setting the binding property to the SfExpander IsVisibleProperty. Please refer the following code snippet.
Code snippet
|
dependentExpander.SetBinding(SfExpander.IsVisibleProperty, "ExpanderVisible"); |
We have attached the tested sample in the following link for your reference.
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ExpanderXamarin446986131
We hope this helps. Please let us know, if need any further assistance.
Regards,
SaiGanesh Sakthivel
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
-
TJ TJISMH
- Mar 28, 2020 10:49 PM UTC
- Mar 31, 2020 02:36 PM UTC