Skip to content
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
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ public static MauiApp CreateMauiApp()

## Platform-specific Implementations

`SelectableLabel` uses platform-specific handlers to achieve cross-platform compatibility. On Android, it leverages `TextView` with selectable properties, while on iOS and MacCatalyst, `UITextView` provides similar functionality.
`SelectableLabel` uses platform-specific handlers to achieve cross-platform compatibility:

- **Android**: Uses `TextView` with `SetTextIsSelectable(true)` for text selection functionality
- **iOS & MacCatalyst**: Uses `UITextView` with `Selectable = true` and `Editable = false`
- **Windows**: Uses `RichTextBlock` with `IsTextSelectionEnabled = true` for WinUI 3 compatibility

## Contributing

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0-android;net9.0-ios</TargetFrameworks>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-windows10.0.19041.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Indiko.Maui.Controls.SelectableLabel.Sample</RootNamespace>
<UseMaui>true</UseMaui>
Expand All @@ -21,6 +21,7 @@

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">30.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -44,8 +45,8 @@

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.80" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.80" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.91" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.91" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Application
x:Class="Indiko.Maui.Controls.SelectableLabel.Sample.WinUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Microsoft.UI.Xaml;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace Indiko.Maui.Controls.SelectableLabel.Sample.WinUI;

/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : MauiWinUIApplication
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
}

protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<WinUISDKReferences>false</WinUISDKReferences>
</PropertyGroup>
</Project>
4 changes: 4 additions & 0 deletions src/Indiko.Maui.Controls.SelectableLabel/BuilderExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
using Indiko.Maui.Controls.SelectableLabel.Platforms.MacCatalyst;
#endif

#if WINDOWS
using Indiko.Maui.Controls.SelectableLabel.Platforms.Windows;
#endif

namespace Indiko.Maui.Controls.SelectableLabel;

public static class BuilderExtension
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst;net8.0-windows10.0.19041.0</TargetFrameworks>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<!-- NuGet -->
<Authors>INDIKO</Authors>
<Copyright>Copyright © INDIKO and contributors</Copyright>
Expand All @@ -30,15 +31,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.80" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.91" />
</ItemGroup>

<ItemGroup>
<None Include="..\Indiko.Maui.Controls.SelectableLabel\icon.png" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.Maui.Controls.Compatibility" Version="9.0.80" />
<PackageReference Update="Microsoft.Maui.Controls.Compatibility" Version="8.0.91" />
</ItemGroup>

</Project>
Loading
Loading