Skip to content

Commit c662fd0

Browse files
committed
Updated ComboBox sample
1 parent ee63da6 commit c662fd0

Some content is hidden

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

45 files changed

+1094
-0
lines changed

SfComboBox/SfComboBox.sln

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31611.283
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SfComboBox", "SfComboBox\SfComboBox.csproj", "{E527A2A1-B4AF-42C8-9C05-7419CEF9398D}"
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+
{E527A2A1-B4AF-42C8-9C05-7419CEF9398D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{E527A2A1-B4AF-42C8-9C05-7419CEF9398D}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{E527A2A1-B4AF-42C8-9C05-7419CEF9398D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
17+
{E527A2A1-B4AF-42C8-9C05-7419CEF9398D}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{E527A2A1-B4AF-42C8-9C05-7419CEF9398D}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{E527A2A1-B4AF-42C8-9C05-7419CEF9398D}.Release|Any CPU.Deploy.0 = Release|Any CPU
20+
EndGlobalSection
21+
GlobalSection(SolutionProperties) = preSolution
22+
HideSolutionNode = FALSE
23+
EndGlobalSection
24+
GlobalSection(ExtensibilityGlobals) = postSolution
25+
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
26+
EndGlobalSection
27+
EndGlobal

SfComboBox/SfComboBox/App.xaml

Lines changed: 14 additions & 0 deletions
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:SfComboBox"
5+
x:Class="SfComboBox.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>

SfComboBox/SfComboBox/App.xaml.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace SfComboBox;
2+
3+
public partial class App : Application
4+
{
5+
public App()
6+
{
7+
InitializeComponent();
8+
9+
MainPage = new AppShell();
10+
}
11+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<Shell
3+
x:Class="SfComboBox.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:SfComboBox"
7+
Shell.FlyoutBehavior="Disabled">
8+
9+
<ShellContent
10+
Title="Home"
11+
ContentTemplate="{DataTemplate local:MainPage}"
12+
Route="MainPage" />
13+
14+
</Shell>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace SfComboBox;
2+
3+
public partial class AppShell : Shell
4+
{
5+
public AppShell()
6+
{
7+
InitializeComponent();
8+
}
9+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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:editors="clr-namespace:Syncfusion.Maui.Inputs;assembly=Syncfusion.Maui.Inputs"
5+
xmlns:local="clr-namespace:SfComboBox"
6+
x:Class="SfComboBox.MainPage">
7+
8+
<ContentPage.BindingContext>
9+
<local:SocialMediaViewModel />
10+
</ContentPage.BindingContext>
11+
12+
13+
<StackLayout Padding="30" >
14+
<editors:SfComboBox HeightRequest="40"
15+
WidthRequest="300"
16+
IsEditable="True"
17+
MaxDropDownHeight="200"
18+
ItemsSource="{Binding SocialMedias}"
19+
ShowDropdownHeaderView="True"
20+
DisplayMemberPath="Name"
21+
DropdownHeaderViewHeight="50"
22+
Margin="50">
23+
<editors:SfComboBox.DropdownHeaderView>
24+
<StackLayout BackgroundColor="#f0f0f0" >
25+
<Label FontSize="20" Text="Header View" TextColor="Red" />
26+
</StackLayout>
27+
</editors:SfComboBox.DropdownHeaderView>
28+
</editors:SfComboBox>
29+
30+
<editors:SfComboBox HeightRequest="40"
31+
WidthRequest="300"
32+
IsEditable="True"
33+
MaxDropDownHeight="200"
34+
ItemsSource="{Binding SocialMedias}"
35+
ShowDropdownFooterView="True"
36+
DisplayMemberPath="Name"
37+
DropdownFooterViewHeight="50">
38+
<editors:SfComboBox.DropdownFooterView>
39+
<StackLayout BackgroundColor="#f0f0f0" >
40+
<Label FontSize="20" Text="Footer View" TextColor="Red" />
41+
</StackLayout>
42+
</editors:SfComboBox.DropdownFooterView>
43+
</editors:SfComboBox>
44+
</StackLayout>
45+
46+
</ContentPage>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+

2+
using Syncfusion.Maui.Inputs;
3+
using System.Collections.ObjectModel;
4+
using System.ComponentModel;
5+
using System.Runtime.CompilerServices;
6+
7+
namespace SfComboBox;
8+
9+
public partial class MainPage : ContentPage {
10+
SocialMediaViewModel socialMediaViewModel = new SocialMediaViewModel();
11+
public MainPage() {
12+
13+
InitializeComponent();
14+
}
15+
}
16+
17+
public class SocialMedia {
18+
public string Name { get; set; }
19+
public int ID { get; set; }
20+
}
21+
22+
//ViewModel.cs
23+
public class SocialMediaViewModel {
24+
25+
public ObservableCollection<SocialMedia> SocialMedias { get; set; }
26+
public SocialMediaViewModel() {
27+
this.SocialMedias = new ObservableCollection<SocialMedia>();
28+
this.SocialMedias.Add(new SocialMedia() { Name = "Facebook", ID = 0 });
29+
this.SocialMedias.Add(new SocialMedia() { Name = "Google Plus", ID = 1 });
30+
this.SocialMedias.Add(new SocialMedia() { Name = "Instagram", ID = 2 });
31+
this.SocialMedias.Add(new SocialMedia() { Name = "LinkedIn", ID = 3 });
32+
this.SocialMedias.Add(new SocialMedia() { Name = "Skype", ID = 4 });
33+
this.SocialMedias.Add(new SocialMedia() { Name = "Telegram", ID = 5 });
34+
this.SocialMedias.Add(new SocialMedia() { Name = "Televzr", ID = 6 });
35+
this.SocialMedias.Add(new SocialMedia() { Name = "Tik Tok", ID = 7 });
36+
this.SocialMedias.Add(new SocialMedia() { Name = "Tout", ID = 8 });
37+
}
38+
39+
}
40+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using CommunityToolkit.Maui;
2+
using Microsoft.Extensions.Logging;
3+
using Syncfusion.Maui.Core.Hosting;
4+
5+
namespace SfComboBox;
6+
7+
public static class MauiProgram
8+
{
9+
public static MauiApp CreateMauiApp()
10+
{
11+
var builder = MauiApp.CreateBuilder();
12+
builder
13+
.UseMauiApp<App>()
14+
.ConfigureSyncfusionCore()
15+
.UseMauiCommunityToolkit()
16+
.ConfigureFonts(fonts =>
17+
{
18+
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
19+
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
20+
});
21+
22+
#if DEBUG
23+
builder.Logging.AddDebug();
24+
#endif
25+
26+
return builder.Build();
27+
}
28+
}
Lines changed: 6 additions & 0 deletions
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>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Android.App;
2+
using Android.Content.PM;
3+
using Android.OS;
4+
5+
namespace SfComboBox.Platforms.Android;
6+
7+
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
8+
public class MainActivity : MauiAppCompatActivity {
9+
}

0 commit comments

Comments
 (0)