Skip to content

Commit fc650d3

Browse files
Merge pull request #62 from telerik/pipelines/latest-8.0.0-apps-13-Nov-15-25
New version of Progress UI for .Net Maui samples with the 8.0.0 release changes
2 parents ee1a019 + bf9062b commit fc650d3

File tree

469 files changed

+10544
-12131
lines changed

Some content is hidden

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

469 files changed

+10544
-12131
lines changed

Samples/AppUtils/AppUtils.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,13 @@
2929
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Condition=" $(CustomMauiNet9Version) != '' " Version="$(CustomMauiNet9Version)" />
3030
</ItemGroup>
3131

32+
<ItemGroup Condition="'$(SolutionName)' != 'Telerik.Maui' And '$(UseSourceProjects)' != 'True' And '$(UseSourceAssemblies)' != 'True'">
33+
<PackageReference Include="Telerik.UI.for.Maui" Version="$(TelerikVersion)" />
34+
</ItemGroup>
35+
36+
<Import Condition="'$(SolutionName)' == 'Telerik.Maui' Or '$(UseSourceProjects)' == 'True'" Project="..\AddSourceProjects.proj" />
37+
<Import Condition="'$(SolutionName)' != 'Telerik.Maui' And '$(UseSourceProjects)' != 'True' And '$(UseSourceAssemblies)' == 'True'" Project="..\AddSourceAssemblies.proj" />
38+
<Import Condition="'$(UsePlatformAssemblies)' == 'True' AND '$(UsePlatformProjects)' != 'True'" Project="..\..\Source\AddPlatformAssemblies.proj" />
39+
<Import Condition="'$(UsePlatformProjects)' == 'True'" Project="..\..\Source\AddPlatformProjects.proj" />
40+
3241
</Project>

Samples/AppUtils/Services/Testing/TestingExtensions.cs

Lines changed: 113 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static MauiAppBuilder UseTelerikInHouseTestingService(this MauiAppBuilder
1616
IsAppUnderTest = defaultIsAppUnderTest,
1717
TestCommandTcpPort = testCommandTcpPort
1818
};
19-
19+
2020
@this.Services.TryAddSingleton<ITestingService>(instance);
2121
DependencyService.RegisterSingleton<ITestingService>(instance);
2222

@@ -28,6 +28,12 @@ public static MauiAppBuilder UseTelerikInHouseTestingService(this MauiAppBuilder
2828
instance.IsAppUnderTest = true;
2929
}
3030

31+
if (instance.IsAppUnderTest)
32+
{
33+
SetAutomationIds();
34+
StopScrollBarsHiding();
35+
}
36+
3137
@this.ConfigureLifecycleEvents(events =>
3238
{
3339
#if ANDROID
@@ -42,6 +48,9 @@ public static MauiAppBuilder UseTelerikInHouseTestingService(this MauiAppBuilder
4248

4349
if (instance.IsAppUnderTest)
4450
{
51+
SetAutomationIds();
52+
StopScrollBarsHiding();
53+
4554
BootUpCommandServer(instance);
4655
}
4756
});
@@ -69,7 +78,17 @@ public static MauiAppBuilder UseTelerikInHouseTestingService(this MauiAppBuilder
6978
BootUpCommandServer(instance);
7079
}
7180

72-
app.Windows.Single().OverrideUserInterfaceStyle = UIKit.UIUserInterfaceStyle.Light;
81+
if (app.Windows.Count() > 0)
82+
{
83+
app.Windows.Single().OverrideUserInterfaceStyle = UIKit.UIUserInterfaceStyle.Light;
84+
}
85+
86+
var window = app.ConnectedScenes.OfType<UIKit.UIWindowScene>().SelectMany(s => s.Windows).FirstOrDefault(w => w.IsKeyWindow);
87+
88+
if (window != null)
89+
{
90+
window.OverrideUserInterfaceStyle = UIKit.UIUserInterfaceStyle.Light;
91+
}
7392

7493
return false;
7594
});
@@ -80,6 +99,95 @@ public static MauiAppBuilder UseTelerikInHouseTestingService(this MauiAppBuilder
8099
return @this;
81100
}
82101

102+
private static void StopScrollBarsHiding()
103+
{
104+
#if WINDOWS
105+
Microsoft.Maui.Handlers.ScrollViewHandler.Mapper.ModifyMapping(nameof(ScrollView.VerticalScrollBarVisibility), (h, v, r) =>
106+
{
107+
Microsoft.UI.Xaml.Setter settter = new Microsoft.UI.Xaml.Setter()
108+
{
109+
Property = Microsoft.UI.Xaml.Controls.Primitives.ScrollBar.IndicatorModeProperty,
110+
Value = Microsoft.UI.Xaml.Controls.Primitives.ScrollingIndicatorMode.MouseIndicator
111+
};
112+
113+
var scroolBarType = typeof(Microsoft.UI.Xaml.Controls.Primitives.ScrollBar);
114+
115+
Microsoft.UI.Xaml.Style style = new Microsoft.UI.Xaml.Style() { TargetType = scroolBarType };
116+
style.Setters.Add(settter);
117+
118+
var scrollView = h.PlatformView;
119+
scrollView.Resources.Add(scroolBarType, style);
120+
});
121+
#endif
122+
}
123+
124+
private static void SetAutomationIds()
125+
{
126+
#if __ANDROID__ || WINDOWS
127+
Microsoft.Maui.Handlers.ViewHandler.ViewMapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
128+
Microsoft.Maui.Handlers.ContentViewHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
129+
Microsoft.Maui.Handlers.ImageButtonHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
130+
Microsoft.Maui.Handlers.LabelHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
131+
Microsoft.Maui.Handlers.LayoutHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
132+
Microsoft.Maui.Handlers.PickerHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
133+
Microsoft.Maui.Handlers.RadioButtonHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
134+
Microsoft.Maui.Handlers.ScrollViewHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
135+
Microsoft.Maui.Handlers.SearchBarHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
136+
Microsoft.Maui.Handlers.SliderHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
137+
Microsoft.Maui.Handlers.SwitchHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
138+
Microsoft.Maui.Handlers.TimePickerHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
139+
Microsoft.Maui.Handlers.DatePickerHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
140+
Microsoft.Maui.Handlers.ButtonHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
141+
Maui.Handlers.RadButtonHandler.RadButtonMapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
142+
Maui.Handlers.RadBorderHandler.BorderMapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
143+
Maui.Handlers.RadItemsControlHandler.ItemsControlMapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
144+
Maui.Handlers.RadCheckBoxHandler.RadCheckBoxMapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
145+
#if __ANDROID__
146+
// NOTE: The Semantics mapper sets MauiAccessibilityDelegateCompat that prevents ContentDescription from being set for EditText.
147+
// Because of that Semantics mapper is modified and does not do anything.
148+
// For reference see: https://github.com/dotnet/maui/blob/main/src/Core/src/Platform/Android/SemanticExtensions.cs#L26
149+
Microsoft.Maui.Handlers.EntryHandler.Mapper.ModifyMapping(nameof(IView.Semantics), (h, v, m) => { });
150+
Microsoft.Maui.Handlers.EntryHandler.Mapper.ModifyMapping(nameof(IView.AutomationId), (h, v, m) => SetEditTextContentDescription(h, v));
151+
#endif
152+
#endif
153+
}
154+
155+
#if __ANDROID__ || WINDOWS
156+
private static void SetAutomationId(IView v)
157+
{
158+
var automationId = v.AutomationId;
159+
if (!string.IsNullOrEmpty(automationId))
160+
{
161+
if (v is BindableObject element)
162+
{
163+
#if WINDOWS
164+
// NOTE: If TextInput has placeholder don't set description. The default description of the platform control is the placeholder.
165+
if (element is Telerik.Maui.IRadTextInput textInput && !string.IsNullOrEmpty(textInput.Placeholder))
166+
{
167+
return;
168+
}
169+
#endif
170+
SemanticProperties.SetDescription(element, automationId);
171+
}
172+
}
173+
}
174+
#endif
175+
176+
#if __ANDROID__
177+
private static void SetEditTextContentDescription(Microsoft.Maui.Handlers.IEntryHandler handler, IView view)
178+
{
179+
var automationId = view.AutomationId;
180+
if (!string.IsNullOrEmpty(automationId))
181+
{
182+
var platformView = handler.PlatformView;
183+
if (platformView != null)
184+
{
185+
platformView.ContentDescription = automationId;
186+
}
187+
}
188+
}
189+
#endif
190+
83191
private static void BootUpCommandServer(TestingService testingService)
84192
{
85193
int? port = testingService.TestCommandTcpPort;
@@ -107,7 +215,7 @@ private static void BootUpCommandServer(TestingService testingService)
107215
tcpCommandServer.BeginAcceptTcpClient(BeginAcceptTcpClientAsync, testingService);
108216
Console.WriteLine("TEST COMMAND! Listening on " + port.Value);
109217
}
110-
catch(Exception e)
218+
catch (Exception e)
111219
{
112220
Console.WriteLine("TEST COMMAND! Failed to start server.");
113221
Console.WriteLine(e);
@@ -125,7 +233,7 @@ private static void BeginAcceptTcpClientAsync(IAsyncResult client)
125233
using var reader = new StreamReader(stream);
126234
using var writer = new StreamWriter(stream);
127235
string? line = null;
128-
while((line = await reader.ReadLineAsync()) != null)
236+
while ((line = await reader.ReadLineAsync()) != null)
129237
{
130238
Console.WriteLine($"TEST COMMAND> {line}");
131239
try
@@ -137,7 +245,7 @@ private static void BeginAcceptTcpClientAsync(IAsyncResult client)
137245
await writer.FlushAsync();
138246
}
139247
}
140-
catch(Exception e)
248+
catch (Exception e)
141249
{
142250
await writer.WriteLineAsync($"ERROR: {e.Message}");
143251
await writer.FlushAsync();

Samples/AppUtils/Services/Testing/TestingService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public class TestingService : ITestingService
99
public Random Random(int seed) => this.IsAppUnderTest ? new Random(seed) : new Random();
1010

1111
public DateTime DateTimeNow(DateTime staticTime) => this.IsAppUnderTest ? staticTime : DateTime.Now;
12-
12+
1313
internal Task<string?> HandleCommandAsync(string line)
1414
{
1515
var args = new TestCommandEventArgs(line);

Samples/ControlsSamples/App.xaml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
x:Class="QSF.App">
99
<Application.Resources>
1010
<ResourceDictionary>
11-
<ResourceDictionary.MergedDictionaries>
12-
<local:TelerikTheming />
13-
</ResourceDictionary.MergedDictionaries>
14-
1511
<!--Accent colors-->
1612
<Color x:Key="ApplicationAccentColor">#8660C5</Color>
1713
<Color x:Key="AccentColor2">#3341A1</Color>
@@ -25,26 +21,18 @@
2521

2622
<!--Text colors-->
2723
<Color x:Key="DefaultTextColor">#000000</Color>
28-
<Color x:Key="DefaultTextColorDark">#FFFFFF</Color>
2924
<Color x:Key="TextOnAccentColor">#FFFFFF</Color>
3025
<Color x:Key="PlaceholderColor">#99000000</Color>
31-
<Color x:Key="PlaceholderColorDark">#CCFFFFFF</Color>
3226

3327
<!--Background colors-->
3428
<Color x:Key="DefaultBackgroundColor">#F8F8F8</Color>
35-
<Color x:Key="DefaultBackgroundColorDark">#121212</Color>
3629
<Color x:Key="SecondaryBackgroundColor">#FFFFFF</Color>
37-
<Color x:Key="SecondaryBackgroundColorDark">#000000</Color>
3830
<Color x:Key="ItemBackgroundColor">#FFFFFF</Color>
39-
<Color x:Key="ItemBackgroundColorDark">#1E1E1E</Color>
4031

4132
<!--Border/stroke colors-->
4233
<Color x:Key="DefaultBorderColor">#DFDFDF</Color>
4334
<Color x:Key="DefaultBorderColorWinUI">#0F000000</Color>
44-
<Color x:Key="DefaultBorderColorDark">#373737</Color>
45-
<Color x:Key="DefaultBorderColorDarkWinUI">#12FFFFFF</Color>
4635
<Color x:Key="SeparatorColor">#E3E4E5</Color>
47-
<Color x:Key="SeparatorColorDark">#373737</Color>
4836
<Color x:Key="SeparatorOnAccentColor">#36FFFFFF</Color>
4937

5038
<telerik:InvertedBooleanConverter x:Key="InvertedBooleanConverter" />
@@ -95,7 +83,7 @@
9583
BetaTemplate="{StaticResource BetaStatusTemplate}" />
9684

9785
<Style x:Key="BaseLabelStyle" TargetType="Label">
98-
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource DefaultTextColor}, Dark={StaticResource DefaultTextColorDark}}" />
86+
<Setter Property="TextColor" Value="{StaticResource DefaultTextColor}" />
9987
</Style>
10088

10189
<Style x:Key="LabelOnAccentStyle" TargetType="Label">
@@ -220,11 +208,20 @@
220208

221209
<Style x:Key="PageStyle" TargetType="ContentPage">
222210
<Setter Property="NavigationPage.HasNavigationBar" Value="False" />
223-
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light=White, Dark=Black}" />
211+
<Setter Property="BackgroundColor" Value="White" />
212+
</Style>
213+
214+
<Style x:Key="PageAppBarImageButtonStyle" TargetType="ImageButton">
215+
<Setter Property="VerticalOptions" Value="Center" />
216+
<Setter Property="HeightRequest" Value="24" />
217+
<Setter Property="WidthRequest" Value="24" />
218+
<Setter Property="Margin" Value="8, 0, 0, 0" />
224219
</Style>
225220

226-
<Style TargetType="Label">
227-
<Setter Property="TextColor" Value="{DynamicResource RadOnAppSurfaceColor}" />
221+
<Style x:Key="ControlWrapperBorderStyle" TargetType="telerik:RadBorder">
222+
<Setter Property="BackgroundColor" Value="{StaticResource DefaultBackgroundColor}" />
223+
<Setter Property="Padding" Value="16, 24" />
224+
<Setter Property="CornerRadius" Value="{OnPlatform Default=0, MacCatalyst=2, WinUI=2}" />
228225
</Style>
229226
</ResourceDictionary>
230227
</Application.Resources>

Samples/ControlsSamples/App.xaml.cs

Lines changed: 9 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
using System;
2-
using Microsoft.Maui;
1+
using Microsoft.Maui;
32
using Microsoft.Maui.Controls;
43
using Microsoft.Maui.Devices;
54
using Microsoft.Maui.Graphics;
65
using Microsoft.Maui.Handlers;
7-
using Telerik.Maui.Controls;
8-
using Telerik.AppUtils.Services;
9-
using QSF.Common;
106
using QSF.Pages;
117
using QSF.Services;
12-
using Application = Microsoft.Maui.Controls.Application;
13-
using System.Threading.Tasks;
148
using QSF.ViewModels;
15-
using System.Linq;
169
using System.Collections.Generic;
10+
using System.Linq;
1711
using System.Text.Json;
12+
using System.Threading.Tasks;
13+
using Telerik.AppUtils.Services;
14+
using Telerik.Maui.Controls;
15+
using Application = Microsoft.Maui.Controls.Application;
1816

1917
namespace QSF;
2018

@@ -47,10 +45,10 @@ public App(ITestingService testingService)
4745
await DependencyService
4846
.Get<INavigationService>()
4947
.NavigateCommand(location);
50-
48+
5149
tcs.SetResult("OK");
5250
}
53-
catch(Exception e)
51+
catch (Exception e)
5452
{
5553
tcs.SetException(e);
5654
}
@@ -98,43 +96,9 @@ await DependencyService
9896
#endif
9997
}
10098
}
101-
102-
#if __ANDROID__ || WINDOWS
103-
Microsoft.Maui.Handlers.ViewHandler.ViewMapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
104-
Microsoft.Maui.Handlers.ContentViewHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
105-
Microsoft.Maui.Handlers.ImageButtonHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
106-
Microsoft.Maui.Handlers.LabelHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
107-
Microsoft.Maui.Handlers.LayoutHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
108-
Microsoft.Maui.Handlers.PickerHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
109-
Microsoft.Maui.Handlers.RadioButtonHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
110-
Microsoft.Maui.Handlers.ScrollViewHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
111-
Microsoft.Maui.Handlers.SearchBarHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
112-
Microsoft.Maui.Handlers.SliderHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
113-
Microsoft.Maui.Handlers.SwitchHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
114-
Microsoft.Maui.Handlers.TimePickerHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
115-
Microsoft.Maui.Handlers.DatePickerHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
116-
Microsoft.Maui.Handlers.ButtonHandler.Mapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
117-
Telerik.Maui.Handlers.RadEntryHandler.EntryViewMapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
118-
Telerik.Maui.Handlers.RadButtonHandler.RadButtonMapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
119-
Telerik.Maui.Handlers.RadBorderHandler.BorderMapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
120-
Telerik.Maui.Handlers.RadItemsControlHandler.ItemsControlMapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
121-
Telerik.Maui.Handlers.RadCheckBoxHandler.RadCheckBoxMapper.AppendToMapping(nameof(IView.AutomationId), (h, v) => SetAutomationId(v));
122-
#endif
123-
}
124-
125-
private static void SetAutomationId(IView v)
126-
{
127-
var automationId = v.AutomationId;
128-
if (!string.IsNullOrEmpty(automationId))
129-
{
130-
BindableObject element = v as BindableObject;
131-
if (element != null)
132-
{
133-
SemanticProperties.SetDescription(element, automationId);
134-
}
135-
}
13699
}
137100

101+
public static Color ApplicationAccentColor => (Color)App.Current.Resources["ApplicationAccentColor"];
138102

139103
public static void DisplayAlert(string text)
140104
{
@@ -216,10 +180,8 @@ protected override Window CreateWindow(IActivationState activationState)
216180
window.Title = "Telerik UI for .NET MAUI Controls Samples";
217181
#endif
218182

219-
#if NET7_0_OR_GREATER
220183
window.MinimumWidth = 1024;
221184
window.MinimumHeight = 768;
222-
#endif
223185
}
224186

225187
return window;

Samples/ControlsSamples/Common/Example.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@ public class Example
2323

2424
public bool IsConfigurable { get; set; }
2525

26+
public bool IsThemable { get; set; }
27+
2628
public StatusType Status { get; set; }
2729
}

Samples/ControlsSamples/Common/TelerikControlsIcons.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ internal static class TelerikControlsIcons
2222
{ "ComboBox", char.ConvertFromUtf32(0xe011) },
2323
{ "DataForm", char.ConvertFromUtf32(0xe012) },
2424
{ "DataGrid", char.ConvertFromUtf32(0xe013) },
25+
{ "DataPager", char.ConvertFromUtf32(0xe042) },
2526
{ "DatePicker", char.ConvertFromUtf32(0xe014) },
2627
{ "DateTimePicker", char.ConvertFromUtf32(0xe015) },
2728
{ "DockLayout", char.ConvertFromUtf32(0xe016) },
2829
{ "Entry", char.ConvertFromUtf32(0xe017) },
2930
{ "Expander", char.ConvertFromUtf32(0xe018) },
3031
{ "Gauge", char.ConvertFromUtf32(0xe019) },
32+
{ "GridSplitter", char.ConvertFromUtf32(0xe043) },
3133
{ "ImageEditor", char.ConvertFromUtf32(0xe01a) },
3234
{ "ItemsControl", char.ConvertFromUtf32(0xe01b) },
3335
{ "ListPicker", char.ConvertFromUtf32(0xe01c) },
@@ -98,6 +100,10 @@ public static string GetExampleIcon(Example example)
98100
{
99101
return char.ConvertFromUtf32(0xe03d);
100102
}
103+
else if (example.Name.Equals("Theming"))
104+
{
105+
return char.ConvertFromUtf32(0xe044);
106+
}
101107
else
102108
{
103109
if (controlName.Equals("Chart"))

0 commit comments

Comments
 (0)