Skip to content

Commit

Permalink
Blog sample for feedback added.
Browse files Browse the repository at this point in the history
  • Loading branch information
jayaleshwari committed Jan 2, 2025
1 parent 59b4e22 commit 66653a2
Show file tree
Hide file tree
Showing 76 changed files with 38,987 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ListViewMAUI.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35514.174 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ListViewMAUI", "ListViewMAUI\ListViewMAUI.csproj", "{30C18789-EE99-4889-9F95-883E68B0D85D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{30C18789-EE99-4889-9F95-883E68B0D85D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30C18789-EE99-4889-9F95-883E68B0D85D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30C18789-EE99-4889-9F95-883E68B0D85D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{30C18789-EE99-4889-9F95-883E68B0D85D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30C18789-EE99-4889-9F95-883E68B0D85D}.Release|Any CPU.Build.0 = Release|Any CPU
{30C18789-EE99-4889-9F95-883E68B0D85D}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
21 changes: 21 additions & 0 deletions ListViewMAUI/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ListViewMAUI"
xmlns:syncTheme="clr-namespace:Syncfusion.Maui.Themes;assembly=Syncfusion.Maui.Core"
x:Class="ListViewMAUI.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
<syncTheme:SyncfusionThemeResourceDictionary />
<ResourceDictionary>
<x:String x:Key="SfListViewTheme">CommonTheme</x:String>
<Color x:Key="SfListViewHoverListViewItemBackground">Transparent</Color>
<Color x:Key="SfListViewItemRippleBackground">Transparent</Color>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
12 changes: 12 additions & 0 deletions ListViewMAUI/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace ListViewMAUI
{
public partial class App : Application
{
public App()
{
InitializeComponent();

MainPage = new MainPage();
}
}
}
67 changes: 67 additions & 0 deletions ListViewMAUI/ListViewMAUI.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->

<!-- Note for MacCatalyst:
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->

<OutputType>Exe</OutputType>
<RootNamespace>ListViewMAUI</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<!-- Display name -->
<ApplicationTitle>ListViewMAUI</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.listviewmaui</ApplicationId>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />

<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />

<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />

<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
<PackageReference Include="Syncfusion.Maui.Buttons" Version="28.1.33" />
<PackageReference Include="Syncfusion.Maui.ListView" Version="28.1.33" />
</ItemGroup>

</Project>
59 changes: 59 additions & 0 deletions ListViewMAUI/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:syncfusion="clr-namespace:Syncfusion.Maui.ListView;assembly=Syncfusion.Maui.ListView"
xmlns:buttons="clr-namespace:Syncfusion.Maui.Buttons;assembly=Syncfusion.Maui.Buttons"
xmlns:local="clr-namespace:ListViewMAUI"
x:Class="ListViewMAUI.MainPage">

<ContentPage.BindingContext>
<local:FeedbackViewModel/>
</ContentPage.BindingContext>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<syncfusion:SfListView x:Name="feedbackList"
SelectionMode="None"
ItemsSource="{Binding Feedbacks}"
ItemSpacing="20"
AutoFitMode="DynamicHeight">
<syncfusion:SfListView.ItemTemplate>
<DataTemplate>
<Grid x:Name="Feedback">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Text="{Binding QNo}"/>
<Grid x:Name="QA" Grid.Column="1" RowSpacing="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Text="{Binding Question}" Grid.Row="0" FontSize="16"/>

<Entry Text="{Binding Answer}" IsVisible="{Binding IsDetailedFeedback}" Grid.Row="1"/>

<buttons:SfRadioGroup x:Name="radioGroup" Grid.Row="1" SelectedValue="{Binding SelectedValue}"
BindableLayout.ItemsSource="{Binding Answers}" >
<BindableLayout.ItemTemplate>
<DataTemplate>
<buttons:SfRadioButton
Text="{Binding Answer}" IsChecked="{Binding IsChecked}" />
</DataTemplate>
</BindableLayout.ItemTemplate>
</buttons:SfRadioGroup>

</Grid>
</Grid>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
</syncfusion:SfListView>

<Button Text="Submit" Grid.Row="1" Command="{Binding SubmitCommand}" HeightRequest="40" HorizontalOptions="End" Margin="20"/>

</Grid>
</ContentPage>
16 changes: 16 additions & 0 deletions ListViewMAUI/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace ListViewMAUI
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}

private void OnRadioGroupCheckedChanged(object sender, Syncfusion.Maui.Buttons.CheckedChangedEventArgs e)
{

}
}

}
27 changes: 27 additions & 0 deletions ListViewMAUI/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.Extensions.Logging;
using Syncfusion.Maui.Core.Hosting;

namespace ListViewMAUI
{
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});

#if DEBUG
builder.Logging.AddDebug();
#endif
builder.ConfigureSyncfusionCore();

return builder.Build();
}
}
}
119 changes: 119 additions & 0 deletions ListViewMAUI/Model/Feedback.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace ListViewMAUI
{
public class Feedback : INotifyPropertyChanged
{
private int qNo;
private string question;
private string answer;

public int QNo
{
get { return qNo; }
set
{
qNo = value;
OnPropertyChanged("QNo");
}
}
public string Question
{
get
{
return question;
}
set
{
question = value;
OnPropertyChanged("Question");
}
}
public string Answer
{
get { return answer; }
set
{
answer = value;
OnPropertyChanged("Answer");
}
}
public ObservableCollection<AnswerModel> Answers { get; set; }

public bool IsDetailedFeedback
{
get
{
if (Answers == null)
return true;

if (Answers.Count > 1)
return false;

return false;
}
}

private string? selectedValue;
public string? SelectedValue
{
get { return selectedValue; }
set
{
selectedValue = value;
OnPropertyChanged("SelectedValue");
}
}


public event PropertyChangedEventHandler? PropertyChanged;
public void OnPropertyChanged(string name)
{
if (this.PropertyChanged != null)
this.PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}

public class AnswerModel : INotifyPropertyChanged
{
private string answer;
public string Answer
{
get { return answer; }
set { answer = value; OnPropertyChanged("Answer"); }
}

private bool? isChecked;
public bool? IsChecked
{
get { return isChecked; }
set
{
isChecked = value; OnPropertyChanged("IsChecked");
}
}

#region Interface Member

public event PropertyChangedEventHandler PropertyChanged;

public void OnPropertyChanged(string name)
{
if (this.PropertyChanged != null)
this.PropertyChanged(this, new PropertyChangedEventArgs(name));
}
#endregion
}

public class ResponseModel
{
public string QNO { get; set; }
public List<Response> ResponseList { get; set; }
}
public class Response
{
public string Question { get; set; }
public string Answer { get; set; }
}
}
6 changes: 6 additions & 0 deletions ListViewMAUI/Platforms/Android/AndroidManifest.xml
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">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
11 changes: 11 additions & 0 deletions ListViewMAUI/Platforms/Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Android.App;
using Android.Content.PM;
using Android.OS;

namespace ListViewMAUI
{
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
}
}
16 changes: 16 additions & 0 deletions ListViewMAUI/Platforms/Android/MainApplication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Android.App;
using Android.Runtime;

namespace ListViewMAUI
{
[Application]
public class MainApplication : MauiApplication
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}

protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
6 changes: 6 additions & 0 deletions ListViewMAUI/Platforms/Android/Resources/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
</resources>
Loading

0 comments on commit 66653a2

Please sign in to comment.