Reputation: 11
I have a TableView
inside of a RelativeLayout
:
<some code>
<RelativeLayout x:Name="relativeLayout">
<some code >
<TableView x:Name="tableView"
RelativeLayout.WidthConstraint="{ConstraintExpression
Type=RelativeToParent, Property=Width, Factor=1, Constant=0}"
RelativeLayout.YConstraint="{ConstraintExpression
Type=RelativeToView, ElementName=banner, Property=Height, Factor=1,Constant=120}"
RelativeLayout.HeightConstraint="{ConstraintExpression
Type=RelativeToParent,Property=Height, Factor=1, Constant=210}">
<some code>
I need to switch the Constant value of the TableView HeightConstraint between 210 (in the portrait device orientation) and 500 (in the Landscape device orientation).
Thanks
Upvotes: 1
Views: 159
Reputation: 11
Iam dooing nearly the same in my App by using "DynamicResource". You can define them in your XAML and while running, change the values in Page codebehind file in C#.
But there seams to be a better solution now, yust have a look on: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/visual-state-manager
Upvotes: 1