Added Size Font To Fit label effect sample

This commit is contained in:
Depechie 2017-09-18 22:01:12 +02:00
Родитель 58602917ed
Коммит 9ef060926c
7 изменённых файлов: 111 добавлений и 2 удалений

Просмотреть файл

@ -65,6 +65,12 @@
<Compile Include="Views\EffectsEntrySelectAllTextPage.xaml.cs">
<DependentUpon>EffectsEntrySelectAllTextPage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\EffectsLabelPage.xaml.cs">
<DependentUpon>EffectsLabelPage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\EffectsLabelSizeFontToFitPage.xaml.cs">
<DependentUpon>EffectsLabelSizeFontToFitPage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\EffectsPage.xaml.cs">
<DependentUpon>EffectsPage.xaml</DependentUpon>
</Compile>
@ -188,6 +194,18 @@
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Views\EffectsLabelSizeFontToFitPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Views\EffectsLabelPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\..\packages\Xamarin.Forms.2.3.4.247\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.4.247\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

Просмотреть файл

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="FormsCommunityToolkit.Samples.Views.EffectsLabelPage">
<Grid HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button Text="Size font to fit effect"
Clicked="OnSizeFontToFitButtonClicked"
Grid.Row="0" />
</Grid>
</ContentPage>

Просмотреть файл

@ -0,0 +1,19 @@
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace FormsCommunityToolkit.Samples.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class EffectsLabelPage : ContentPage
{
public EffectsLabelPage()
{
InitializeComponent();
}
private async void OnSizeFontToFitButtonClicked(object sender, System.EventArgs e)
{
await Navigation.PushAsync(new EffectsLabelSizeFontToFitPage());
}
}
}

Просмотреть файл

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="FormsCommunityToolkit.Samples.Views.EffectsLabelSizeFontToFitPage"
xmlns:effects="clr-namespace:FormsCommunityToolkit.Effects;assembly=FormsCommunityToolkit.Effects"
Title="Size font to fit label">
<Grid Margin="10,20,10,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Text="Size font to fit label"
Grid.Row="0" Margin="0,0,0,20" />
<Label Text="Size font to fit label now with long text to see the difference in font size"
Grid.Row="1">
<Label.Effects>
<effects:LabelSizeFontToFit />
</Label.Effects>
</Label>
<Label Text="Size font to fit label now with long text to see the difference in font size"
Grid.Row="2" />
</Grid>
</ContentPage>

Просмотреть файл

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace FormsCommunityToolkit.Samples.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class EffectsLabelSizeFontToFitPage : ContentPage
{
public EffectsLabelSizeFontToFitPage()
{
InitializeComponent();
}
}
}

Просмотреть файл

@ -7,14 +7,19 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button Text="Label effects"
Clicked="OnLabelButtonClicked"
Grid.Row="0" />
<Button Text="Entry effects"
Clicked="OnEntryButtonClicked"
Grid.Row="0" />
Grid.Row="1" />
<Button Text="Switch effects"
Clicked="OnSwitchButtonClicked"
Grid.Row="1" />
Grid.Row="2" />
</Grid>
</ContentPage>

Просмотреть файл

@ -10,6 +10,11 @@ namespace FormsCommunityToolkit.Samples.Views
InitializeComponent();
}
private async void OnLabelButtonClicked(object sender, System.EventArgs e)
{
await Navigation.PushAsync(new EffectsLabelPage());
}
private async void OnEntryButtonClicked(object sender, System.EventArgs e)
{
await Navigation.PushAsync(new EffectsEntryPage());