I have a Registration Form which looks roughly like this
<StackLayout>
<StackLayout
HorizontalOptions="FillAndExpand"
Padding="{x:Static local:Styles.LabelBeforeEntryPadding}">
<Label
Text="{Binding LabelPasswort2}"
HorizontalOptions="{x:Static local:Styles.LabelHorizontalOptions}"
TextColor="{x:Static local:Styles.RegistrationPageTextColor}" />
</StackLayout>
<custom:StrypeEntry
Text="{Binding Passwort2}"
IsPassword="true"
IsEnabled="{Binding ControlsEnabled}"
HorizontalOptions="FillAndExpand" />
</StackLayout>
<!--Newsletter-->
<StackLayout
Orientation="Horizontal"
HorizontalOptions="StartAndExpand">
<Switch
IsToggled="{Binding Newsletter}"
IsEnabled="{Binding ControlsEnabled}"
VerticalOptions="StartAndExpand"
HorizontalOptions="StartAndExpand" />
<Label
Text="{Binding LabelNewsletter}"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Start"
TextColor="{x:Static local:Styles.RegistrationPageTextColor}" />
</StackLayout>
<!--Datenschutz-->
<StackLayout
Orientation="Horizontal"
HorizontalOptions="StartAndExpand">
<custom:StrypeSwitch
IsToggled="{Binding Privacy}"
IsEnabled="{Binding ControlsEnabled}"
VerticalOptions="StartAndExpand"
HorizontalOptions="StartAndExpand" />
<Label
Text="{Binding LabelPrivacy}"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Start"
WidthRequest="300" TextColor="{x:Static local:Styles.RegistrationPageTextColor}" />
</StackLayout>
The Problem is that the Switches are not visible when displaying the Form, they only become visible when an entry is focused.
The StrypeEntry is just a customized Entry with Border Corder and a prop for Capitalize, nothing fancy and for the switch I made a Custom Renderer to fix the issue of not displaying.
I already tried the fix for the ButtonText Alignment which did not help (Xamarin.Forms: wrong button text alignment after click (Android))
I also tried this
public override void ChildDrawableStateChanged(View child)
{
base.ChildDrawableStateChanged(child);
Control.Text = Control.Text;
Control.Checked = Control.Checked;
}
but still no fix
(I'm testing on a GT-I9505 with Android 4.4.2. The Version of the Xamarin.Forms Assemblies is 1.2.2.0)
Please help me, Thank you
Seems like I have to answer my own question.
I fixed the issue by adding a Height- and WidthRequest to the Switch in the xaml
Hope this helps someone else. And maybe if you find a better solution, please let me know.
greetings~
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With