searchBar, switch, checkbox

main
syneffort 2 years ago
parent b5b428b41c
commit 79d7f412cb
  1. 17
      XamarinStudy/XamarinStudy/XamarinStudy/Views/SampleElementPage1.xaml
  2. 22
      XamarinStudy/XamarinStudy/XamarinStudy/Views/SampleElementPage1.xaml.cs

@ -8,20 +8,23 @@
</Button> </Button>
<Label x:Name="lbl1" Text="This is Lable" TextColor="DarkSlateBlue" BackgroundColor="LightPink" FontSize="Large" FontAttributes="Bold"/> <Label x:Name="lbl1" Text="This is Lable" TextColor="DarkSlateBlue" BackgroundColor="LightPink" FontSize="Large" FontAttributes="Bold"/>
<Label Text="This is Lable" TextColor="DarkSlateBlue" BackgroundColor="LightPink" FontSize="Large" FontAttributes="Bold" HorizontalTextAlignment="End"/> <!--<Label Text="This is Lable" TextColor="DarkSlateBlue" BackgroundColor="LightPink" FontSize="Large" FontAttributes="Bold" HorizontalTextAlignment="End"/>-->
<Label Text="This is Lable" TextColor="DarkSlateBlue" BackgroundColor="LightPink" FontSize="Large" FontAttributes="Bold" HorizontalTextAlignment="Start"/> <!--<Label Text="This is Lable" TextColor="DarkSlateBlue" BackgroundColor="LightPink" FontSize="Large" FontAttributes="Bold" HorizontalTextAlignment="Start"/>-->
<Label Text="This is Lable" TextColor="DarkSlateBlue" BackgroundColor="LightPink" FontSize="Large" FontAttributes="Italic" HorizontalTextAlignment="Center"/> <!--<Label Text="This is Lable" TextColor="DarkSlateBlue" BackgroundColor="LightPink" FontSize="Large" FontAttributes="Italic" HorizontalTextAlignment="Center"/>-->
<Label Text="This is 30 Lable" TextColor="Red" BackgroundColor="LightPink" FontSize="30" HorizontalTextAlignment="Center"/> <!--<Label Text="This is 30 Lable" TextColor="Red" BackgroundColor="LightPink" FontSize="30" HorizontalTextAlignment="Center"/>-->
<Entry Placeholder="Input Text" TextColor="Salmon" FontSize="Large" FontAttributes="Bold" Keyboard="Text"/> <Entry x:Name="entryText" Placeholder="Input Text" TextColor="Salmon" FontSize="Large" FontAttributes="Bold" Keyboard="Text"/>
<Entry Placeholder="Input Number" BindingContext="{x:Reference stepper1}" TextColor="Red" FontSize="{Binding Value}" FontAttributes="Bold" Keyboard="Numeric"/> <Entry x:Name="entryNum" Placeholder="Input Number" BindingContext="{x:Reference stepper1}" TextColor="Red" FontSize="{Binding Value}" FontAttributes="Bold" Keyboard="Numeric"/>
<Editor Placeholder="Input Message" BindingContext="{x:Reference slider1}" Rotation="{Binding Value}" TextColor="Red" BackgroundColor="{OnPlatform Android=Blue,UWP=White}" FontSize="{Binding Value}" FontAttributes="Bold" HeightRequest="100"/> <Editor x:Name="editor" Placeholder="Input Message" BindingContext="{x:Reference slider1}" Rotation="{Binding Value}" TextColor="Red" BackgroundColor="{OnPlatform Android=Blue,UWP=White}" FontSize="{Binding Value}" FontAttributes="Bold" HeightRequest="100"/>
<Slider x:Name="slider1" Maximum="100" Minimum="0" Value="0" MinimumTrackColor="Salmon" MaximumTrackColor="DarkRed"/> <Slider x:Name="slider1" Maximum="100" Minimum="0" Value="0" MinimumTrackColor="Salmon" MaximumTrackColor="DarkRed"/>
<Stepper x:Name="stepper1" Maximum="50" Minimum="5" Increment="5" Value="20" ValueChanged="stepper1_ValueChanged"/> <Stepper x:Name="stepper1" Maximum="50" Minimum="5" Increment="5" Value="20" ValueChanged="stepper1_ValueChanged"/>
<ProgressBar x:Name="pb1" ProgressColor="Orange"/> <ProgressBar x:Name="pb1" ProgressColor="Orange"/>
<ProgressBar x:Name="pb2" ProgressColor="Red"/> <ProgressBar x:Name="pb2" ProgressColor="Red"/>
<ProgressBar x:Name="pb3" ProgressColor="Green"/> <ProgressBar x:Name="pb3" ProgressColor="Green"/>
<SearchBar x:Name="searchBar" Placeholder="Search" TextChanged="searchBar_TextChanged"/>
<Switch x:Name="switch" ThumbColor="Tomato" OnColor="Gray" IsToggled="True" HorizontalOptions="StartAndExpand" Toggled="switch_Toggled"/>
<CheckBox x:Name="checkBox" Color="CornflowerBlue" CheckedChanged="checkBox_CheckedChanged"/>
</StackLayout> </StackLayout>
</ContentPage.Content> </ContentPage.Content>
</ContentPage> </ContentPage>

@ -33,5 +33,27 @@ namespace XamarinStudy.Views
pb2.ProgressTo(e.NewValue / 100, 1000, Easing.SpringOut); pb2.ProgressTo(e.NewValue / 100, 1000, Easing.SpringOut);
pb3.ProgressTo(e.NewValue / 100, 1500, Easing.BounceOut); pb3.ProgressTo(e.NewValue / 100, 1500, Easing.BounceOut);
} }
private void searchBar_TextChanged(object sender, TextChangedEventArgs e)
{
if (string.IsNullOrEmpty(e.NewTextValue) || string.IsNullOrEmpty(editor.Text))
return;
char a = e.NewTextValue[0];
int count = editor.Text.Count(x => x == a);
entryNum.Text = count.ToString();
}
private void switch_Toggled(object sender, ToggledEventArgs e)
{
entryText.Text = e.Value.ToString();
entryText.IsEnabled = e.Value;
}
private void checkBox_CheckedChanged(object sender, CheckedChangedEventArgs e)
{
entryText.Text = e.Value.ToString();
entryText.IsEnabled = e.Value;
}
} }
} }
Loading…
Cancel
Save