Skip to content

Commit 50be4cf

Browse files
Merge pull request #8 from telerik/marchev/maui-dg-semantic-search
Add a .NET MAUI DataGrid demo for semantic/similarity search
2 parents 9c1ac5a + 7ea1ce6 commit 50be4cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1163
-1
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Telerik Smart (AI) Components
22

3-
Telerik Smart(AI) Components make it easy to add AI-powered features to your .NET applications without extra effort. Smart(AI) Components are currently in an **experimental phase** and are available for [Telerik UI for Blazor](https://www.telerik.com/blazor-ui), [Telerik UI for ASP.NET Core](https://www.telerik.com/aspnet-core-ui), [Telerik UI for WPF](https://www.telerik.com/products/wpf/overview.aspx), and [Telerik UI for WinForms](https://www.telerik.com/products/winforms.aspx).
3+
Telerik Smart(AI) Components make it easy to add AI-powered features to your .NET applications without extra effort. Smart(AI) Components are currently in an **experimental phase** and are available for [Telerik UI for Blazor](https://www.telerik.com/blazor-ui), [Telerik UI for ASP.NET Core](https://www.telerik.com/aspnet-core-ui), [Telerik UI for WPF](https://www.telerik.com/products/wpf/overview.aspx), [Telerik UI for WinForms](https://www.telerik.com/products/winforms.aspx), and [Telerik UI for .NET MAUI](https://www.telerik.com/maui-ui).
44

55
### 🚀 Your feedback matters
66
We are looking to expand the use cases for AI-powered components and highly value your input on their usefulness and potential applications. Please share your thoughts and suggestions at the following [link](https://progresssoftware.typeform.com/to/L47CZisw).
@@ -11,6 +11,7 @@ The source code for the experiments is currently available in the repository und
1111
- [Telerik UI for ASP.NET Core](https://github.com/telerik/smart-ai-components/tree/master/core)
1212
- [Telerik UI for WPF](https://github.com/telerik/smart-ai-components/tree/master/wpf)
1313
- [Telerik UI for WinForms](https://github.com/telerik/smart-ai-components/tree/master/winforms)
14+
- [Telerik UI for .NET MAUI](https://github.com/telerik/smart-ai-components/tree/master/maui)
1415

1516
You can also check out our demos on telerik.com:
1617

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35417.141 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIDataGridSemanticSearch", "AIDataGridSemanticSearch\AIDataGridSemanticSearch.csproj", "{42334BD4-657C-4C64-8805-111C1C42D799}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{42334BD4-657C-4C64-8805-111C1C42D799}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{42334BD4-657C-4C64-8805-111C1C42D799}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{42334BD4-657C-4C64-8805-111C1C42D799}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
17+
{42334BD4-657C-4C64-8805-111C1C42D799}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{42334BD4-657C-4C64-8805-111C1C42D799}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{42334BD4-657C-4C64-8805-111C1C42D799}.Release|Any CPU.Deploy.0 = Release|Any CPU
20+
EndGlobalSection
21+
GlobalSection(SolutionProperties) = preSolution
22+
HideSolutionNode = FALSE
23+
EndGlobalSection
24+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
6+
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
7+
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
8+
9+
<!-- Note for MacCatalyst:
10+
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
11+
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
12+
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
13+
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
14+
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
15+
16+
<OutputType>Exe</OutputType>
17+
<RootNamespace>AIDataGridSemanticSearch</RootNamespace>
18+
<UseMaui>true</UseMaui>
19+
<SingleProject>true</SingleProject>
20+
<ImplicitUsings>enable</ImplicitUsings>
21+
<Nullable>enable</Nullable>
22+
23+
<!-- Display name -->
24+
<ApplicationTitle>AIDataGridSemanticSearch</ApplicationTitle>
25+
26+
<!-- App Identifier -->
27+
<ApplicationId>com.companyname.aidatagridsemanticsearch</ApplicationId>
28+
29+
<!-- Versions -->
30+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
31+
<ApplicationVersion>1</ApplicationVersion>
32+
33+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
34+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
35+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
36+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
37+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
38+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
39+
40+
<!-- Work-around for Skia issue with latest MAUI -->
41+
<WindowsSdkPackageVersion>10.0.19041.54</WindowsSdkPackageVersion>
42+
43+
</PropertyGroup>
44+
45+
<ItemGroup>
46+
<!-- App Icon -->
47+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
48+
49+
<!-- Splash Screen -->
50+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
51+
52+
<!-- Images -->
53+
<MauiImage Include="Resources\Images\*" />
54+
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
55+
56+
<!-- Custom Fonts -->
57+
<MauiFont Include="Resources\Fonts\*" />
58+
59+
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
60+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
61+
</ItemGroup>
62+
63+
<ItemGroup>
64+
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
65+
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
66+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
67+
<PackageReference Include="SmartComponents.LocalEmbeddings" Version="0.1.0-preview10148" />
68+
<PackageReference Include="Telerik.UI.for.Maui" Version="7.1.0" />
69+
</ItemGroup>
70+
71+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version = "1.0" encoding = "UTF-8" ?>
2+
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:AIDataGridSemanticSearch"
5+
x:Class="AIDataGridSemanticSearch.App">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
10+
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
11+
</ResourceDictionary.MergedDictionaries>
12+
</ResourceDictionary>
13+
</Application.Resources>
14+
</Application>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace AIDataGridSemanticSearch
2+
{
3+
public partial class App : Application
4+
{
5+
public App()
6+
{
7+
InitializeComponent();
8+
9+
MainPage = new AppShell();
10+
}
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<Shell
3+
x:Class="AIDataGridSemanticSearch.AppShell"
4+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6+
xmlns:local="clr-namespace:AIDataGridSemanticSearch"
7+
Shell.FlyoutBehavior="Disabled"
8+
Title="AIDataGridSemanticSearch">
9+
10+
<ShellContent
11+
Title="Home"
12+
ContentTemplate="{DataTemplate local:MainPage}"
13+
Route="MainPage" />
14+
15+
</Shell>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace AIDataGridSemanticSearch
2+
{
3+
public partial class AppShell : Shell
4+
{
5+
public AppShell()
6+
{
7+
InitializeComponent();
8+
}
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:telerik="http://schemas.telerik.com/2022/xaml/maui"
5+
x:Class="AIDataGridSemanticSearch.MainPage">
6+
7+
<Grid RowDefinitions="Auto, *">
8+
<Label Text="Try typing 'milk', 'oatmeal', or 'cake' in the search box and click 'Enter' to see how our smart search works in action!" Margin="10" />
9+
<telerik:RadDataGrid x:Name="dataGrid"
10+
ItemsSource="{Binding Data}"
11+
Grid.Row="1">
12+
<telerik:RadDataGrid.SearchSettings>
13+
<telerik:DataGridSearchSettings ProvideSearchMatchesAction="{Binding SemanticSearch}"
14+
ApplyFilter="False"
15+
SearchTrigger="Completed" />
16+
</telerik:RadDataGrid.SearchSettings>
17+
<telerik:RadDataGrid.SearchPanel>
18+
<telerik:DataGridSearchPanel IsVisible="True" />
19+
</telerik:RadDataGrid.SearchPanel>
20+
</telerik:RadDataGrid>
21+
</Grid>
22+
23+
</ContentPage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace AIDataGridSemanticSearch
2+
{
3+
public partial class MainPage : ContentPage
4+
{
5+
public MainPage()
6+
{
7+
InitializeComponent();
8+
9+
this.BindingContext = new MainViewModel();
10+
}
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Microsoft.Extensions.Logging;
2+
using Telerik.Maui.Controls.Compatibility;
3+
4+
namespace AIDataGridSemanticSearch
5+
{
6+
public static class MauiProgram
7+
{
8+
public static MauiApp CreateMauiApp()
9+
{
10+
var builder = MauiApp.CreateBuilder();
11+
builder
12+
.UseMauiApp<App>()
13+
.UseTelerik()
14+
.ConfigureFonts(fonts =>
15+
{
16+
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
17+
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
18+
});
19+
20+
#if DEBUG
21+
builder.Logging.AddDebug();
22+
#endif
23+
24+
return builder.Build();
25+
}
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace AIDataGridSemanticSearch;
2+
3+
public class Product
4+
{
5+
public int CategoryId { get; set; }
6+
public string CategoryName { get; set; }
7+
public string Description { get; set; }
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
namespace AIDataGridSemanticSearch;
2+
3+
public static class ProductService
4+
{
5+
public static List<Product> CreateData()
6+
{
7+
List<Product> data = new List<Product>
8+
{
9+
new Product { CategoryId = 1, CategoryName = "Beverages", Description = "Soft drinks, coffees, teas, beers, and ales" },
10+
new Product { CategoryId = 2, CategoryName = "Condiments", Description = "Sweet and savory sauces, relishes, spreads, and seasonings" },
11+
new Product { CategoryId = 3, CategoryName = "Confections", Description = "Desserts, candies, and sweet breads" },
12+
new Product { CategoryId = 4, CategoryName = "Dairy Products", Description = "Cheeses" },
13+
new Product { CategoryId = 5, CategoryName = "Grains/Cereals", Description = "Breads, crackers, pasta, and cereal" },
14+
new Product { CategoryId = 6, CategoryName = "Meat/Poultry", Description = "Prepared meats" },
15+
new Product { CategoryId = 7, CategoryName = "Produce", Description = "Dried fruit and bean curd" },
16+
new Product { CategoryId = 8, CategoryName = "Seafood", Description = "Seaweed and fish" },
17+
};
18+
19+
return data;
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
4+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using Android.App;
2+
using Android.Content.PM;
3+
using Android.OS;
4+
5+
namespace AIDataGridSemanticSearch
6+
{
7+
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
8+
public class MainActivity : MauiAppCompatActivity
9+
{
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Android.App;
2+
using Android.Runtime;
3+
4+
namespace AIDataGridSemanticSearch
5+
{
6+
[Application]
7+
public class MainApplication : MauiApplication
8+
{
9+
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
10+
: base(handle, ownership)
11+
{
12+
}
13+
14+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="colorPrimary">#512BD4</color>
4+
<color name="colorPrimaryDark">#2B0B98</color>
5+
<color name="colorAccent">#2B0B98</color>
6+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Foundation;
2+
3+
namespace AIDataGridSemanticSearch
4+
{
5+
[Register("AppDelegate")]
6+
public class AppDelegate : MauiUIApplicationDelegate
7+
{
8+
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<!-- See https://aka.ms/maui-publish-app-store#add-entitlements for more information about adding entitlements.-->
5+
<dict>
6+
<!-- App Sandbox must be enabled to distribute a MacCatalyst app through the Mac App Store. -->
7+
<key>com.apple.security.app-sandbox</key>
8+
<true/>
9+
<!-- When App Sandbox is enabled, this value is required to open outgoing network connections. -->
10+
<key>com.apple.security.network.client</key>
11+
<true/>
12+
</dict>
13+
</plist>
14+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<!-- The Mac App Store requires you specify if the app uses encryption. -->
6+
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/itsappusesnonexemptencryption -->
7+
<!-- <key>ITSAppUsesNonExemptEncryption</key> -->
8+
<!-- Please indicate <true/> or <false/> here. -->
9+
10+
<!-- Specify the category for your app here. -->
11+
<!-- Please consult https://developer.apple.com/documentation/bundleresources/information_property_list/lsapplicationcategorytype -->
12+
<!-- <key>LSApplicationCategoryType</key> -->
13+
<!-- <string>public.app-category.YOUR-CATEGORY-HERE</string> -->
14+
<key>UIDeviceFamily</key>
15+
<array>
16+
<integer>2</integer>
17+
</array>
18+
<key>UIRequiredDeviceCapabilities</key>
19+
<array>
20+
<string>arm64</string>
21+
</array>
22+
<key>UISupportedInterfaceOrientations</key>
23+
<array>
24+
<string>UIInterfaceOrientationPortrait</string>
25+
<string>UIInterfaceOrientationLandscapeLeft</string>
26+
<string>UIInterfaceOrientationLandscapeRight</string>
27+
</array>
28+
<key>UISupportedInterfaceOrientations~ipad</key>
29+
<array>
30+
<string>UIInterfaceOrientationPortrait</string>
31+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
32+
<string>UIInterfaceOrientationLandscapeLeft</string>
33+
<string>UIInterfaceOrientationLandscapeRight</string>
34+
</array>
35+
<key>XSAppIconAssets</key>
36+
<string>Assets.xcassets/appicon.appiconset</string>
37+
</dict>
38+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using ObjCRuntime;
2+
using UIKit;
3+
4+
namespace AIDataGridSemanticSearch
5+
{
6+
public class Program
7+
{
8+
// This is the main entry point of the application.
9+
static void Main(string[] args)
10+
{
11+
// if you want to use a different Application Delegate class from "AppDelegate"
12+
// you can specify it here.
13+
UIApplication.Main(args, null, typeof(AppDelegate));
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)