Skip to content

Commit 3821c97

Browse files
Merge pull request #1 from SyncfusionExamples/852373_UpdateReadme
852373_Updated Readme file
2 parents 9fef25c + db1089e commit 3821c97

File tree

1 file changed

+97
-1
lines changed

1 file changed

+97
-1
lines changed

README.md

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,98 @@
1-
# How-to-customize-TextInputLayout-appearance-
1+
# How to customize TextInputLayout appearance
22
This demo sample explains how to customize TextInputLayout appearance
3+
# Adding SfTextInputLayout reference
4+
You can add SfTextInputLayout reference using one of the following methods:
5+
6+
## Method 1: Adding SfTextInputLayout reference from nuget.org
7+
8+
Syncfusion Xamarin components are available in nuget.org. To add SfTextInputLayout to your project, open the NuGet package manager in Visual Studio, search for Syncfusion.Xamarin.Core, and then install it.
9+
10+
11+
## Method 2: Adding SfTextInputLayout reference from toolbox
12+
13+
Syncfusion also provides Xamarin Toolbox. Using this toolbox, you can drag the Xamarin Text Input Layout (SfTextInputLayout) control to the XAML page. It will automatically install the required NuGet packages and add the namespace to the page. To install Syncfusion Xamarin Toolbox, refer to Toolbox.
14+
15+
## Method 3: Adding SfTextInputLayout assemblies manually from the installed location
16+
17+
If you prefer to manually reference the assemblies instead referencing from NuGet, add the following assemblies in respective projects.
18+
19+
# Initializing text input layout
20+
Import the SfTextInputLayout control namespace in respective page as demonstrated in the following code sample.
21+
22+
**[XAML]**
23+
```
24+
xmlns:inputLayout="clr-namespace:Syncfusion.XForms.TextInputLayout;assembly=Syncfusion.Core.XForms"
25+
```
26+
**[C#]**
27+
```
28+
using Syncfusion.XForms.TextInputLayout;
29+
```
30+
Add any input view control such as Entry, Editor, SfNumericTextBox, SfNumericUpDown, SfMaskedEdit, SfAutoComplete, SfComboBox, Picker,DatePicker or TimePicker and add hint label (floating label).
31+
32+
**[XAML]**
33+
```
34+
<inputLayout:SfTextInputLayout>
35+
<Entry />
36+
</inputLayout:SfTextInputLayout>
37+
```
38+
**[C#]**
39+
```
40+
var inputLayout = new SfTextInputLayout();
41+
inputLayout.InputView = new Entry();
42+
```
43+
44+
# How to customize the properties of (outline border colors, hint name, helper text, error text, and char count) of TextInputLayout in Xamarin.Forms
45+
Color customization of outline border can be achieved by setting respective color for FocusedColor (focussed state) and UnfocusedColor (unfocussed state) properties of SfTextInputLayout as shown in below code snippet.
46+
47+
**[XAML]**
48+
```
49+
<StackLayout VerticalOptions="Center" HorizontalOptions="StartAndExpand">
50+
<inputLayout:SfTextInputLayout Hint="Email" ContainerType="Outlined"
51+
HelperText="Enter your email"
52+
FocusedColor=" DarkCyan"
53+
UnfocusedColor="Gray"><Entry/>
54+
</inputLayout:SfTextInputLayout>
55+
</StackLayout>
56+
57+
```
58+
## Color Customization for Assistive Labels
59+
By merging the below mentioned keys in application resources, it is possible to customize the appearance of the SfTextInputLayout without merging common theme resource and control style resource dictionaries as shown in below code snippet.
60+
61+
**[XAML]**
62+
```
63+
<Application.Resources>
64+
        <syncTheme:SyncfusionThemeDictionary>
65+
            <syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
66+
                <ResourceDictionary>
67+
                    <x:String x:Key="SfTextInputLayoutTheme">CustomTheme</x:String>
68+
                    <!--Hint Color for focused state-->
69+
                    <Color x:Key="SyncPrimaryLightColor"> Black </Color>
70+
                    <!--Hint Color for default state-->
71+
                    <Color x:Key="SfTextInputLayoutHintColor">Gray</Color>
72+
                    <!--Border Color for focused state-->
73+
                    <Color x:Key="SyncPrimaryColor"> DarkCyan </Color>
74+
                    <!--Border Color for default state-->
75+
                    <Color x:Key="SfTextInputLayoutLineColor">Gray</Color>
76+
                    <!--Helper text Color for default state-->
77+
                    <Color x:Key="SfTextInputLayoutHelperTextColor"> BlueViolet</Color>
78+
                    <!--Character count text Color for default state-->
79+
                    <Color x:Key="SfTextInputLayoutCounterLabelColor"> DarkGoldenrod</Color>
80+
                    <!--Error text Color for default state-->
81+
                    <Color x:Key="SfTextInputLayoutErrorTextColor">Red</Color>
82+
                </ResourceDictionary>
83+
            </syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
84+
        </syncTheme:SyncfusionThemeDictionary>
85+
    </Application.Resources>
86+
87+
```
88+
## How to run this application?
89+
90+
To run this application, you need to first clone the How-to-validate-with-required-verification-in-text-input-layout-in-Xamarin.Forms repository and then open it in Visual Studio 2022. Now, simply build and run your project to view the output.
91+
92+
## <a name="troubleshooting"></a>Troubleshooting ##
93+
### Path too long exception
94+
If you are facing path too long exception when building this example project, close Visual Studio and rename the repository to short and build the project.
95+
96+
## License
97+
98+
Syncfusion has no liability for any damage or consequence that may arise by using or viewing the samples. The samples are for demonstrative purposes, and if you choose to use or access the samples, you agree to not hold Syncfusion liable, in any form, for any damage that is related to use, for accessing, or viewing the samples. By accessing, viewing, or seeing the samples, you acknowledge and agree Syncfusion’s samples will not allow you seek injunctive relief in any form for any claim related to the sample. If you do not agree to this, do not view, access, utilize, or otherwise do anything with Syncfusion’s samples.

0 commit comments

Comments
 (0)