Hello,
Welcome to our Microsoft Q&A platform!
i want to rotate label of header of Xamarin form expander(default value of rotation is +90)
If you want to set default value of rotation to 90, set Rotation="90"
in the label tag directly.
when the expander is expand( when expander is expand then value of rotation will be 0) in Xamarin forms
I notice you used DataTrigger
to achieve it. You set TargetType
correctly, but you lack of Path for Binding
property, you need to set Path value to Expander
's IsExpanded
property like following code. If the value of IsExpanded
is true, we can set the value of Label's Rotation
to 0 with <Setter>
tag. Note: I add x:Name="expander"
for <xct:Expander>
tag.
<Label Text="Search" Grid.Column="0" Margin="0,15,0,5"
TextColor="#3e6db5"
VerticalOptions="Center"
Rotation="90"
FontSize="Micro" >
<Label.Triggers>
<DataTrigger TargetType="Label"
Binding="{Binding Source={x:Reference expander},Path=IsExpanded}"
Value="true">
<Setter Property="Rotation" Value="0" />
</DataTrigger>
</Label.Triggers>
</Label>
Here is a great article about how to use Data triggers, you can refer to it.
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.