searchBar, switch, checkbox
This commit is contained in:
@@ -8,20 +8,23 @@
|
||||
|
||||
</Button>
|
||||
<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="Start"/>
|
||||
<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 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="Italic" 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 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"/>
|
||||
<Entry x:Name="entryText" Placeholder="Input Text" TextColor="Salmon" FontSize="Large" FontAttributes="Bold" Keyboard="Text"/>
|
||||
<Entry x:Name="entryNum" Placeholder="Input Number" BindingContext="{x:Reference stepper1}" TextColor="Red" FontSize="{Binding Value}" FontAttributes="Bold" Keyboard="Numeric"/>
|
||||
<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"/>
|
||||
<Stepper x:Name="stepper1" Maximum="50" Minimum="5" Increment="5" Value="20" ValueChanged="stepper1_ValueChanged"/>
|
||||
<ProgressBar x:Name="pb1" ProgressColor="Orange"/>
|
||||
<ProgressBar x:Name="pb2" ProgressColor="Red"/>
|
||||
<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>
|
||||
</ContentPage.Content>
|
||||
</ContentPage>
|
@@ -29,9 +29,31 @@ namespace XamarinStudy.Views
|
||||
private void stepper1_ValueChanged(object sender, ValueChangedEventArgs e)
|
||||
{
|
||||
lbl1.Text = e.NewValue.ToString("N2");
|
||||
pb1.ProgressTo(e.NewValue/100, 1000, Easing.SpringIn);
|
||||
pb2.ProgressTo(e.NewValue/100, 1000, Easing.SpringOut);
|
||||
pb3.ProgressTo(e.NewValue/100, 1500, Easing.BounceOut);
|
||||
pb1.ProgressTo(e.NewValue / 100, 1000, Easing.SpringIn);
|
||||
pb2.ProgressTo(e.NewValue / 100, 1000, Easing.SpringOut);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user