156 references to Application
Microsoft.Maui.Controls (153)
Application\Application.cs (13)
19
public partial class Application : Element, IResourcesProvider, IApplicationController, IElementConfiguration<
Application
>, IVisualTreeElement, IApplication
22
readonly Lazy<PlatformConfigurationRegistry<
Application
>> _platformConfigurationRegistry;
55
_platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<
Application
>>(() => new PlatformConfigurationRegistry<
Application
>(this));
82
public static void SetCurrentApplication(
Application
value) => Current = value;
85
public static
Application
? Current { get; set; }
308
public IPlatformElementConfiguration<T,
Application
> On<T>() where T : IConfigPlatform
419
ILogger<
Application
>? _logger;
421
ILogger<
Application
>? Logger =>
422
_logger ??= Handler?.MauiContext?.CreateLogger<
Application
>();
451
throw new InvalidOperationException($"Both {nameof(MainPage)} was set and {nameof(
Application
.CreateWindow)} was overridden to provide a page.");
540
throw new NotImplementedException($"Either set {nameof(MainPage)} or override {nameof(
Application
.CreateWindow)}.");
550
throw new NotImplementedException($"Either set {nameof(MainPage)} or override {nameof(
Application
.CreateWindow)}.");
AppThemeBinding.cs (3)
154
Application
app;
158
ve?.Window?.Parent is
Application
a)
164
app =
Application
.Current;
BindableObject.cs (7)
89
Application
.Current?.FindMauiContext()?.CreateLogger<BindableObject>()?.LogWarning($"Cannot set the BindableProperty \"{property.PropertyName}\" because it is readonly.");
103
Application
.Current?.FindMauiContext()?.CreateLogger<BindableObject>()?.LogWarning($"Cannot set the BindableProperty \"{property.PropertyName}\" because it is readonly.");
298
Application
.Current?.FindMauiContext()?.CreateLogger<BindableObject>()?.LogWarning($"Cannot set the a OneWay Binding \"{targetProperty.PropertyName}\" because it is readonly.");
493
Application
.Current?.FindMauiContext()?.CreateLogger<BindableObject>()?.LogWarning($"Cannot set the BindableProperty \"{property.PropertyName}\" because it is readonly.");
521
Application
.Current?.FindMauiContext()?.CreateLogger<BindableObject>()?.LogWarning($"Cannot set the BindableProperty \"{property.PropertyName}\" because it is readonly.");
562
Application
.Current?.FindMauiContext()?.CreateLogger<BindableObject>()?.LogWarning($"Cannot convert {value} to type '{property.ReturnType}'");
568
Application
.Current?.FindMauiContext()?.CreateLogger<BindableObject>()?.LogWarning($"Value is an invalid value for {property.PropertyName}");
BindableObjectExtensions.cs (3)
167
if (
Application
.Current.TryGetResource(resourceKey, out outerColor))
198
if (!
Application
.Current.TryGetResource(lightResourceKey, out outerLight))
203
if (!
Application
.Current.TryGetResource(darkResourceKey, out outerDark))
BindablePropertyConverter.cs (2)
84
Application
.Current?.FindMauiContext()?.CreateLogger<BindablePropertyConverter>()?.LogWarning("Can't resolve properties with xml namespace prefix.");
90
Application
.Current?.FindMauiContext()?.CreateLogger<BindablePropertyConverter>()?.LogWarning($"Can't resolve {value}. Accepted syntax is Type.PropertyName.");
BindingBase.cs (2)
157
Application
.Current?.FindMauiContext()?.CreateLogger<BindingBase>()?.LogWarning("FormatException");
172
Application
.Current?.FindMauiContext()?.CreateLogger<BindingBase>()?.LogWarning("FormatException");
Device.cs (8)
86
Application
.Current.FindDispatcher().IsDispatchRequired;
91
Application
.Current.FindDispatcher().Dispatch(action);
96
Application
.Current.FindDispatcher().DispatchAsync(func);
101
Application
.Current.FindDispatcher().DispatchAsync(action);
106
Application
.Current.FindDispatcher().DispatchAsync(funcTask);
111
Application
.Current.FindDispatcher().DispatchAsync(funcTask);
116
Application
.Current.FindDispatcher().GetSynchronizationContextAsync();
138
var dispatcher =
Application
.Current.FindDispatcher();
DispatcherExtensions.cs (5)
16
if (bindableObject is not
Application
&&
27
if (bindableObject is
Application
app &&
42
if (bindableObject is not
Application
&&
43
Application
.Current?.Dispatcher is IDispatcher appDispatcher)
100
if (
Application
.Current?.Dispatcher is IDispatcher appDispatcher)
Element\Element.cs (3)
297
Application
.Current?
352
Application
.Current?
409
Application
.Current?.FindMauiContext()?.CreateLogger<Element>()?.LogWarning($"{this} is already a child of {element}. Remove {this} from {element} before adding to {value}.");
Hosting\AppHostBuilderExtensions.cs (2)
66
handlersCollection.AddHandler<
Application
, ApplicationHandler>();
245
Application
.RemapForControls();
Interactivity\EventTrigger.cs (1)
85
Application
.Current?.FindMauiContext()?.CreateLogger<EventTrigger>()?.LogWarning("Cannot attach EventTrigger to {Type}.{Event}. Check if the handler exists and if the signature is right.", bindable.GetType(), Event);
Internals\PageExtensions.cs (1)
14
while (!
Application
.IsApplicationOrWindowOrNull(parent.RealParent))
IWindowCreator.cs (1)
5
Window CreateWindow(
Application
app, IActivationState? activationState);
ListView\ListView.cs (2)
638
Application
.Current?.FindMauiContext()?.CreateLogger<ListView>()?.LogWarning("GroupHeaderTemplate and GroupDisplayBinding cannot be set at the same time, setting GroupHeaderTemplate to null");
648
Application
.Current?.FindMauiContext()?.CreateLogger<ListView>()?.LogWarning("GroupHeaderTemplate and GroupDisplayBinding cannot be set at the same time, setting GroupDisplayBinding to null");
MergedStyle.cs (1)
49
Application
.Current?.FindMauiContext()?.CreateLogger<Style>()?.LogWarning("Style TargetType {FullName} is not compatible with element target type {TargetType}", value.TargetType.FullName, TargetType);
NavigationPage\NavigationPage.cs (2)
241
Application
.Current?.FindMauiContext()?.CreateLogger<NavigationPage>()?.LogWarning(e, null);
878
Application
.Current?.FindMauiContext()?.CreateLogger<NavigationPage>()?.LogWarning("RemovePage called for CurrentPage object. This can result in undesired behavior, consider calling PopAsync instead.");
NavigationPage\NavigationPage.Legacy.cs (1)
241
Application
.Current?.FindMauiContext()?.CreateLogger<NavigationPage>()?.LogWarning("RemovePage called for CurrentPage object. This can result in undesired behavior, consider calling PopAsync instead.");
Page\Page.cs (3)
553
if (!
Application
.IsApplicationOrWindowOrNull(RealParent) && !(RealParent is Page) && !(RealParent is BaseShellItem))
727
Application
FindApplication(Element element)
732
return (element.Parent is
Application
app) ? app : FindApplication(element.Parent);
PlatformConfiguration\AndroidSpecific\AppCompat\Application.cs (10)
4
using FormsElement = Maui.Controls.
Application
;
25
public static bool GetSendDisappearingEventOnPause(this IPlatformElementConfiguration<Android,
FormsElement
> config)
31
public static IPlatformElementConfiguration<Android,
FormsElement
> SendDisappearingEventOnPause(this IPlatformElementConfiguration<Android,
FormsElement
> config, bool value)
53
public static bool GetSendAppearingEventOnResume(this IPlatformElementConfiguration<Android,
FormsElement
> config)
59
public static IPlatformElementConfiguration<Android,
FormsElement
> SendAppearingEventOnResume(this IPlatformElementConfiguration<Android,
FormsElement
> config, bool value)
81
public static bool GetShouldPreserveKeyboardOnResume(this IPlatformElementConfiguration<Android,
FormsElement
> config)
87
public static IPlatformElementConfiguration<Android,
FormsElement
> ShouldPreserveKeyboardOnResume(this IPlatformElementConfiguration<Android,
FormsElement
> config, bool value)
PlatformConfiguration\AndroidSpecific\Application.cs (4)
4
using FormsElement = Maui.Controls.
Application
;
38
public static WindowSoftInputModeAdjust GetWindowSoftInputModeAdjust(this IPlatformElementConfiguration<Android,
FormsElement
> config)
44
public static IPlatformElementConfiguration<Android,
FormsElement
> UseWindowSoftInputModeAdjust(this IPlatformElementConfiguration<Android,
FormsElement
> config, WindowSoftInputModeAdjust value)
PlatformConfiguration\iOSSpecific\Application.cs (10)
4
using FormsElement = Maui.Controls.
Application
;
26
public static bool GetPanGestureRecognizerShouldRecognizeSimultaneously(this IPlatformElementConfiguration<iOS,
FormsElement
> config)
32
public static IPlatformElementConfiguration<iOS,
FormsElement
> SetPanGestureRecognizerShouldRecognizeSimultaneously(this IPlatformElementConfiguration<iOS,
FormsElement
> config, bool value)
56
public static bool GetHandleControlUpdatesOnMainThread(this IPlatformElementConfiguration<iOS,
FormsElement
> config)
62
public static IPlatformElementConfiguration<iOS,
FormsElement
> SetHandleControlUpdatesOnMainThread(this IPlatformElementConfiguration<iOS,
FormsElement
> config, bool value)
86
public static bool GetEnableAccessibilityScalingForNamedFontSizes(this IPlatformElementConfiguration<iOS,
FormsElement
> config)
92
public static IPlatformElementConfiguration<iOS,
FormsElement
> SetEnableAccessibilityScalingForNamedFontSizes(this IPlatformElementConfiguration<iOS,
FormsElement
> config, bool value)
PlatformConfiguration\TizenSpecific\Application.cs (13)
6
using FormsElement = Maui.Controls.
Application
;
12
public static readonly BindableProperty UseBezelInteractionProperty = BindableProperty.Create("UseBezelInteraction", typeof(bool), typeof(
FormsElement
), true);
27
public static bool GetUseBezelInteraction(this IPlatformElementConfiguration<Tizen,
FormsElement
> config)
33
public static IPlatformElementConfiguration<Tizen,
FormsElement
> SetUseBezelInteraction(this IPlatformElementConfiguration<Tizen,
FormsElement
> config, bool value)
40
public static readonly BindableProperty OverlayContentProperty = BindableProperty.CreateAttached("OverlayContent", typeof(View), typeof(
FormsElement
), default(View));
55
public static View GetOverlayContent(this IPlatformElementConfiguration<Tizen,
FormsElement
> config)
61
public static IPlatformElementConfiguration<Tizen,
FormsElement
> SetOverlayContent(this IPlatformElementConfiguration<Tizen,
FormsElement
> config, View value)
68
public static readonly BindablePropertyKey ActiveBezelInteractionElementPropertyKey = BindableProperty.CreateAttachedReadOnly("ActiveBezelInteractionElement", typeof(Element), typeof(
FormsElement
), default(Element));
84
public static Element GetActiveBezelInteractionElement(this IPlatformElementConfiguration<Tizen,
FormsElement
> config)
91
public static IPlatformElementConfiguration<Tizen,
FormsElement
> SetActiveBezelInteractionElement(this IPlatformElementConfiguration<Tizen,
FormsElement
> config, Element value)
PlatformConfiguration\WindowsSpecific\Application.cs (5)
5
using FormsElement = Maui.Controls.
Application
;
12
BindableProperty.Create("ImageDirectory", typeof(string), typeof(
FormsElement
), string.Empty,
22
public static string GetImageDirectory(this IPlatformElementConfiguration<Windows,
FormsElement
> config)
34
public static IPlatformElementConfiguration<Windows,
FormsElement
> SetImageDirectory(
35
this IPlatformElementConfiguration<Windows,
FormsElement
> config, string value)
RadioButton\RadioButton.cs (1)
632
Application
.Current?.FindMauiContext()?.CreateLogger<RadioButton>()?.LogWarning("Warning - {RuntimePlatform} does not support View as the {PropertyName} property of RadioButton; the return value of the ToString() method will be displayed instead.", DeviceInfo.Platform, ContentProperty.PropertyName);
Registrar.cs (1)
465
fontRegistrar =
Application
.Current?.FindMauiContext()?.Services?.GetService<IFontRegistrar>();
RelativeBindingSource.cs (1)
122
if (currentElement.RealParent is
Application
||
ResourcesExtensions.cs (6)
33
var
app = element as
Application
;
64
if (element is
Application
app && app.SystemResources != null && app.SystemResources.TryGetValue(key, out value))
70
if (
Application
.Current != null && ((IResourcesProvider)
Application
.Current).IsResourcesCreated &&
Application
.Current.Resources.TryGetValue(key, out value))
Shell\BaseShellItem.cs (1)
492
if (
Application
.Current == null)
Shell\SearchHandler.cs (1)
239
Application
.Current.GetDefaultFontSize();
Shell\Shell.cs (16)
349
while (!
Application
.IsApplicationOrWindowOrNull(element))
615
while (!
Application
.IsApplicationOrWindowOrNull(item))
778
while (!
Application
.IsApplicationOrWindowOrNull(leaf))
958
if (
Application
.Current is null ||
Application
.Current.Windows.Count == 0)
961
if (
Application
.Current.Windows.Count == 1)
963
return
Application
.Current.Windows[0].Page as Shell;
970
foreach (var window in
Application
.Current.Windows)
1002
throw new InvalidOperationException($"Unable to determine the current Shell instance you want to use. Please access Shell via the Windows property on {
Application
.Current.GetType()}.");
1171
if (
Application
.Current != null)
1185
if (
Application
.Current == null)
1190
Application
.Current.RequestedThemeChanged -= OnRequestedThemeChanged;
1193
Application
.Current.RequestedThemeChanged += OnRequestedThemeChanged;
1260
Application
.Current?.FindMauiContext()?.CreateLogger<Shell>()?.LogWarning(exc, "If you're using hot reload add a route to everything in your shell file");
1556
Application
.Current?.FindMauiContext()?.CreateLogger<Shell>()?.LogWarning(exc, "Failed to Navigate Back");
1835
while (!
Application
.IsApplicationOrWindowOrNull(pivot))
Shell\ShellContent.cs (1)
99
throw new NotSupportedException($"Shell is currently not compatible with TabbedPage. Please use TabBar, Tab or switch to using NavigationPage for your {
Application
.Current}.MainPage");
Shell\ShellSection.cs (1)
503
Application
.Current?.FindMauiContext()?.CreateLogger<ShellSection>()?.LogWarning("Failed to Create Content For: {route}", route);
StreamWrapper.cs (1)
98
Application
.Current?.FindMauiContext()?.CreateLogger<StreamWrapper>()?
TemplateUtilities.cs (3)
13
if (element.RealParent is
Application
)
18
while (!
Application
.IsApplicationOrNull(element))
38
if (parent is
Application
)
TypeConversionHelper.cs (1)
173
Application
.Current?.FindMauiContext()?.CreateLogger(nameof(TypeConversionHelper))?.LogWarning(
UriImageSource.cs (2)
75
Application
.Current?.FindMauiContext()?.CreateLogger<UriImageSource>()?.LogWarning(ex, "Error getting stream for {Uri}", Uri);
126
Application
.Current?.FindMauiContext()?.CreateLogger<UriImageSource>()?.LogWarning(ex, "Error getting stream for {Uri}", Uri);
ViewExtensions.cs (4)
297
if (
Application
.Current?.FindMauiContext() is IMauiContext applicationMauiContext)
318
return fallbackToAppMauiContext ?
Application
.Current?.FindMauiContext() : default;
371
while (!
Application
.IsApplicationOrNull(current.RealParent))
383
while (!
Application
.IsApplicationOrWindowOrNull(parent))
Visuals\VisualMarker.cs (1)
29
var logger =
Application
.Current?.FindMauiContext()?.CreateLogger<IVisual>();
Visuals\VisualTypeConverter.cs (5)
86
Application
.Current?.FindMauiContext()?.CreateLogger<IVisual>()?.LogWarning("Cannot scan assembly {assembly} for Visual types.", assembly.FullName);
90
Application
.Current?.FindMauiContext()?.CreateLogger<IVisual>()?.LogWarning("Unable to load a dependent assembly for {assembly}. It cannot be scanned for Visual types.", assembly.FullName);
94
Application
.Current?.FindMauiContext()?.CreateLogger<IVisual>()?.LogWarning("Unable to load a dependent assembly for {assembly}. Types cannot be loaded.", assembly.FullName);
146
Application
.Current?.FindMauiContext()?.CreateLogger<IVisual>()?.LogWarning("Unable to register {visualType} please add a public default constructor", visualType.ToString());
165
Application
.Current?.FindMauiContext()?.CreateLogger<IVisual>()?.LogWarning(
Window\Window.cs (3)
417
Application
? Application => Parent as
Application
;
419
internal void FinishedAddingWindowToApplication(
Application
application)
Xaml\Diagnostics\BindingDiagnostics.cs (2)
18
Application
.Current?.FindMauiContext()?.CreateLogger<BindingDiagnostics>()?.LogWarning(message, messageArgs);
24
Application
.Current?.FindMauiContext()?.CreateLogger<BindingDiagnostics>()?.LogWarning(message, messageArgs);
Microsoft.Maui.Controls.Xaml (3)
MarkupExtensions\StaticResourceExtension.cs (3)
75
return
Application
.Current != null
76
&& ((IResourcesProvider)
Application
.Current).IsResourcesCreated
77
&&
Application
.Current.Resources.TryGetValueAndSource(key, out resource, out resourceDictionary);