Skip to content

Added sample for ComboBoxWordWrap #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions ComboBoxWordWrap/ComboWordWrap.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComboWordWrap.Android", "ComboWordWrap\ComboWordWrap.Android\ComboWordWrap.Android.csproj", "{E9BA50AC-3779-45EA-A3DB-588FC721C267}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComboWordWrap", "ComboWordWrap\ComboWordWrap\ComboWordWrap.csproj", "{008C7B0F-1C9B-42F7-B397-C57245A29BBC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|iPhone = Debug|iPhone
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|iPhone = Release|iPhone
Release|iPhoneSimulator = Release|iPhoneSimulator
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|ARM.ActiveCfg = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|ARM.Build.0 = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|ARM.Deploy.0 = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|iPhone.Build.0 = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|iPhone.Deploy.0 = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|x64.ActiveCfg = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|x64.Build.0 = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|x64.Deploy.0 = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|x86.ActiveCfg = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|x86.Build.0 = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Debug|x86.Deploy.0 = Debug|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|Any CPU.Build.0 = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|Any CPU.Deploy.0 = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|ARM.ActiveCfg = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|ARM.Build.0 = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|ARM.Deploy.0 = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|iPhone.ActiveCfg = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|iPhone.Build.0 = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|iPhone.Deploy.0 = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|x64.ActiveCfg = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|x64.Build.0 = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|x64.Deploy.0 = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|x86.ActiveCfg = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|x86.Build.0 = Release|Any CPU
{E9BA50AC-3779-45EA-A3DB-588FC721C267}.Release|x86.Deploy.0 = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|ARM.ActiveCfg = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|ARM.Build.0 = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|ARM.Deploy.0 = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|iPhone.Build.0 = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|iPhone.Deploy.0 = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|x64.ActiveCfg = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|x64.Build.0 = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|x64.Deploy.0 = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|x86.ActiveCfg = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|x86.Build.0 = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Debug|x86.Deploy.0 = Debug|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|Any CPU.Build.0 = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|Any CPU.Deploy.0 = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|ARM.ActiveCfg = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|ARM.Build.0 = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|ARM.Deploy.0 = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|iPhone.ActiveCfg = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|iPhone.Build.0 = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|iPhone.Deploy.0 = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|x64.ActiveCfg = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|x64.Build.0 = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|x64.Deploy.0 = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|x86.ActiveCfg = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|x86.Build.0 = Release|Any CPU
{008C7B0F-1C9B-42F7-B397-C57245A29BBC}.Release|x86.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A62D36B5-F92D-45F4-A226-BF16B4F8CF8B}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".

These files will be deployed with your package and will be accessible using Android's
AssetManager, like this:

public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);

InputStream input = Assets.Open ("my_asset.txt");
}
}

Additionally, some Android functions will automatically load asset files:

Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E9BA50AC-3779-45EA-A3DB-588FC721C267}</ProjectGuid>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TemplateGuid>{c9e5eea5-ca05-42a1-839b-61506e0a37df}</TemplateGuid>
<OutputType>Library</OutputType>
<RootNamespace>ComboWordWrap.Droid</RootNamespace>
<AssemblyName>ComboWordWrap.Android</AssemblyName>
<Deterministic>True</Deterministic>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v13.0</TargetFrameworkVersion>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Android" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Syncfusion.Xamarin.SfComboBox" Version="*"/>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2196" />
<PackageReference Include="Xamarin.Essentials" Version="1.7.0" />
</ItemGroup>
<ItemGroup>
<Compile Include="CustomRenderer.cs" />
<Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Assets\AboutAssets.txt" />
<None Include="Properties\AndroidManifest.xml" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\values\styles.xml" />
<AndroidResource Include="Resources\values\colors.xml" />
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon.xml" />
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon_round.xml" />
<AndroidResource Include="Resources\mipmap-hdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-hdpi\launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-mdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-mdpi\launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xhdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-xhdpi\launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xxhdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-xxhdpi\launcher_foreground.png" />
<AndroidResource Include="Resources\mipmap-xxxhdpi\icon.png" />
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\drawable\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ComboWordWrap\ComboWordWrap.csproj">
<Project>{DC2B8472-0B3D-4CF0-930A-47DC72220F7D}</Project>
<Name>ComboWordWrap</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using ComboWordWrap;
using ComboWordWrap.Droid;
using Syncfusion.Android.ComboBox;
using Syncfusion.XForms.Android.ComboBox;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(SfCustomComboBox), typeof(CustomRenderer))]
namespace ComboWordWrap.Droid
{
public class CustomRenderer:SfComboBoxRenderer
{
public CustomRenderer(Context context) : base(context)
{
}

protected override void OnElementChanged(ElementChangedEventArgs<Syncfusion.XForms.ComboBox.SfComboBox> e)
{
base.OnElementChanged(e);
Control.GetAutoEditText().SetLines(8);
Control.GetAutoEditText().SetHorizontallyScrolling(false);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;

using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Android.OS;

namespace ComboWordWrap.Droid
{
[Activity(Label = "ComboWordWrap", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);

Xamarin.Essentials.Platform.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
}
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
{
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);

base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.combowordwrap">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
<application android:label="ComboWordWrap.Android" android:theme="@style/MainTheme"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Android.App;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ComboWordWrap.Android")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ComboWordWrap.Android")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

// Add some common permissions, these can be removed if not needed
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Images, layout descriptions, binary blobs and string dictionaries can be included
in your application as resource files. Various Android APIs are designed to
operate on the resource IDs instead of dealing with images, strings or binary blobs
directly.

For example, a sample Android app that contains a user interface layout (main.xml),
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
would keep its resources in the "Resources" directory of the application:

Resources/
drawable-hdpi/
icon.png

drawable-ldpi/
icon.png

drawable-mdpi/
icon.png

layout/
main.xml

values/
strings.xml

In order to get the build system to recognize Android resources, set the build action to
"AndroidResource". The native Android APIs do not operate directly with filenames, but
instead operate on resource IDs. When you compile an Android application that uses resources,
the build system will package the resources for distribution and generate a class called
"Resource" that contains the tokens for each one of the resources included. For example,
for the above Resources layout, this is what the Resource class would expose:

public class Resource {
public class drawable {
public const int icon = 0x123;
}

public class layout {
public const int main = 0x456;
}

public class strings {
public const int first_string = 0xabc;
public const int second_string = 0xbcd;
}
}

You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main
to reference the layout/main.xml file, or Resource.strings.first_string to reference the first
string in the dictionary file values/strings.xml.
Loading
Loading