### Example: Get Connection ID and Start Video Preview (C#) Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.activation.barcodescannerpreviewactivatedeventargs.connectionid This example demonstrates how to retrieve the connection ID from activated arguments and use it to start a video preview page. Ensure the BarcodeScannerProviderConnection is valid before proceeding. ```csharp protected override async void OnActivated(IActivatedEventArgs args) { base.OnActivated(args); if (args.Kind == ActivationKind.BarcodeScannerProvider) { ... // Create and activate root frame. var eventArgs = args as BarcodeScannerPreviewActivatedEventArgs; string connectionId = eventArgs.ConnectionId; BarcodeScannerProviderConnection connection = _taskList.GetConnection(connectionId); if (connection != null) { var page = rootFrame.Content as MainPage; if (page != null) { await page.StartVideoPreview(connection); } } } } ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.gaming.input.custom.igamecontrollerprovider.hardwareversioninfo Example of how to get the hardware version information in C#. ```csharp var gameControllerVersionInfo = iGameControllerProvider.hardwareVersionInfo; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.media.capture.mediacaptureinitializationsettings.videosource Example of getting and setting the VideoSource property in C#. ```csharp var iMediaSource = mediaCaptureInitializationSettings.videoSource; mediaCaptureInitializationSettings.videoSource = iMediaSource; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.management.update.windowsupdatemanagerscanoptions.isuserinitiated A basic C# example demonstrating how to get and set the IsUserInitiated property. ```csharp var boolean = windowsUpdateManagerScanOptions.isUserInitiated; windowsUpdateManagerScanOptions.isUserInitiated = boolean; ``` -------------------------------- ### C# Example: Monitoring Pictures Library Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.background.storagelibrarycontentchangedtrigger.create This example shows how to get access to the Pictures library and create a trigger to monitor it for changes. ```csharp //Get access to the library that you want to monitor StorageLibrary picturesLibrary = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures); var trigger = StorageLibraryContentChangedTrigger.Create(picturesLibrary); ``` -------------------------------- ### C# Example Usage Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.contacts.contactquerytextsearch.fields Example of how to get and set the Fields property in C#. ```csharp var contactQuerySearchFields = contactQueryTextSearch.fields; contactQueryTextSearch.fields = contactQuerySearchFields; ``` -------------------------------- ### C# Usage Example for CompositionSpriteShape.StrokeStartCap Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.composition.compositionspriteshape.strokestartcap Example of how to get and set the StrokeStartCap property in C#. ```csharp var compositionStrokeCap = compositionSpriteShape.strokeStartCap; compositionSpriteShape.strokeStartCap = compositionStrokeCap; ``` -------------------------------- ### Redirecting Activation to Recommended Instance Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.appinstance.recommendedinstance This example demonstrates checking if a recommended instance is available and suitable, and then redirecting activation to it. If no recommendation is made, the app handles the redirection logic itself. ```APIDOC ## Examples This example checks whether the shell recommends an instance, by using the app-defined _SelectedKeyIncludesMyKey_ method. If so, it checks whether the instance is suitable, and redirects to a suitable instance. If the shell does not have preference, the app can look for an existing app instance to redirect to or attempt to register itself as the target. ```csharp AppInstance RecommendedInstance = AppInstance.RecommendedInstance; if ((RecommendedInstance != null) && SelectedKeyIncludesMyKey(RecommendedInstance.Key)) { RecommendedInstance.RedirectActivationTo(); } else { // Look for existing instance or attempt to register itself as target. } ``` ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.graphics.printing.iprinttaskoptionscoreproperties.orientation Example of getting and setting the Orientation property in C#. ```csharp var printOrientation = iPrintTaskOptionsCoreProperties.orientation; iPrintTaskOptionsCoreProperties.orientation = printOrientation; ``` -------------------------------- ### C# - Get InputStream Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.custom.customdevice.inputstream Example of how to get the InputStream property in C#. ```csharp var iInputStream = customDevice.inputStream; ``` -------------------------------- ### C# Example: Check and Redirect Activation Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.appinstance.recommendedinstance This example checks if the shell recommends an instance and redirects activation if suitable. If no preference, the app handles instance lookup or registration. ```csharp AppInstance RecommendedInstance = AppInstance.RecommendedInstance; if ((RecommendedInstance != null) && SelectedKeyIncludesMyKey(RecommendedInstance.Key)) { RecommendedInstance.RedirectActivationTo(); } else { // Look for existing instance or attempt to register itself as target. } ``` -------------------------------- ### C# Example: Accessing and Setting WrappingVMode Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.composition.scenes.scenesurfacematerialinput.wrappingvmode Example demonstrating how to get and set the WrappingVMode property in C#. ```csharp var sceneWrappingMode = sceneSurfaceMaterialInput.wrappingVMode; sceneSurfaceMaterialInput.wrappingVMode = sceneWrappingMode; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.lowleveldevicescontroller.defaultprovider Example of how to get and set the DefaultProvider property in C#. ```csharp var iLowLevelDevicesAggregateProvider = LowLevelDevicesController.defaultProvider; LowLevelDevicesController.defaultProvider = iLowLevelDevicesAggregateProvider; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.media.protection.imediaprotectionservicerequest.protectionsystem Example of how to retrieve the protection system GUID in C#. ```C# var guid = iMediaProtectionServiceRequest.protectionSystem; ``` -------------------------------- ### Window Class Examples Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.window Code examples demonstrating typical usage patterns for the Window.Current, Window.Content properties, and the Window.Activate method, particularly within the OnLaunched override. ```APIDOC ## Examples The following code example shows the OnLaunched method override generated for the blank application template in Microsoft Visual Studio. This code demonstrates typical usage patterns for the Current and Content properties and the Activate method. C# Copy ``` protected override void OnLaunched(LaunchActivatedEventArgs args) { // Create a Frame to act navigation context and navigate to the first page var rootFrame = new Frame(); rootFrame.Navigate(typeof(BlankPage)); // Place the frame in the current Window and ensure that it is active Window.Current.Content = rootFrame; Window.Current.Activate(); } ``` ``` Protected Overrides Sub OnLaunched(args As Windows.ApplicationModel.Activation.LaunchActivatedEventArgs) ' Create a Frame to act navigation context and navigate to the first page Dim rootFrame As New Frame() rootFrame.Navigate(GetType(BlankPage)) ' Place the frame in the current Window and ensure that it is active Window.Current.Content = rootFrame Window.Current.Activate() End Sub ``` ``` -------------------------------- ### C# Get TransactionId Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.store.unfulfilledconsumable.transactionid Example of how to get the TransactionId property in C#. ```C# var guid = unfulfilledConsumable.transactionId; ``` -------------------------------- ### C# Get and Set Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.shell.windowtabthumbnailrequestedeventargs.image A practical example in C# showing how to retrieve the current image and assign a new IRandomAccessStreamReference to the Image property. ```csharp var iRandomAccessStreamReference = windowTabThumbnailRequestedEventArgs.image; windowTabThumbnailRequestedEventArgs.image = iRandomAccessStreamReference; ``` -------------------------------- ### C# Example: Deferred Play To Source Request Source: https://learn.microsoft.com/en-us/uwp/api/windows.media.playto.playtosourcerequest.getdeferral This C# example demonstrates how to handle a deferred Play To source request. It shows how to get a deferral, retrieve media asynchronously, set the source, and complete the deferral. ```csharp private Windows.Media.PlayTo.PlayToManager ptm = Windows.Media.PlayTo.PlayToManager.GetForCurrentView(); protected override void OnNavigatedTo(NavigationEventArgs e) { ptm.SourceRequested += sourceRequestHandlerDeferred; } async private void sourceRequestHandlerDeferred( Windows.Media.PlayTo.PlayToManager sender, Windows.Media.PlayTo.PlayToSourceRequestedEventArgs e) { var deferral = e.SourceRequest.GetDeferral(); // Async call to get source media var element = await getMediaElementAsync(); e.SourceRequest.SetSource(element.PlayToSource); deferral.Complete(); } ``` -------------------------------- ### C# Get and Set Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.composition.compositionsurfacebrush.rotationangleindegrees Example of getting and setting the RotationAngleInDegrees property in C#. ```csharp var single = compositionSurfaceBrush.rotationAngleInDegrees; compositionSurfaceBrush.rotationAngleInDegrees = single; ``` -------------------------------- ### PrepareBinding and Clear Example (C#) Source: https://learn.microsoft.com/en-us/uwp/api/windows.ai.machinelearning.preview.learningmodelbindingpreview.clear Demonstrates how to bind an image to a LearningModelBindingPreview and then clear the binding. This example shows a typical workflow before evaluating a model and then cleaning up resources. ```csharp public void PrepareBinding(LearningModelPreview model, VideoFrame picture) { ImageVariableDescriptorPreview inputImageDescription; List inputFeatures = model.Description.InputFeatures.ToList(); inputImageDescription = inputFeatures.FirstOrDefault(feature => feature.ModelFeatureKind == LearningModelFeatureKindPreview.Image) as ImageVariableDescriptorPreview; // Bind the image var binding = new LearningModelBindingPreview(model); binding.Bind(inputImageDescription, picture); } //Evaluate and other application logic ... binding.Clear(); } ``` -------------------------------- ### Get UserActivity Session Start Time (VB.NET) Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.useractivities.useractivitysessionhistoryitem.starttime Get the time when the user started engaging in the UserActivity associated with this UserActivitySessionHistoryItem. This is the VB.NET syntax. ```vbnet Public ReadOnly Property StartTime As DateTimeOffset ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.email.emailirmtemplate.description Example of getting and setting the description property in C#. ```csharp var string = emailIrmTemplate.description; emailIrmTemplate.description = string; ``` -------------------------------- ### Get UserActivity Session Start Time (C++/CX) Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.useractivities.useractivitysessionhistoryitem.starttime Get the time when the user started engaging in the UserActivity associated with this UserActivitySessionHistoryItem. This is the C++/CX syntax. ```cpluspluscx public: property DateTime StartTime { DateTime get(); }; ``` -------------------------------- ### Launcher.LaunchFileAsync with DisplayApplicationPicker Source: https://learn.microsoft.com/en-us/uwp/api/windows.system.launcher.launchfileasync Demonstrates how to launch a file and allow the user to select the application to open it with by setting `DisplayApplicationPicker` to true in `LauncherOptions`. ```APIDOC ## Launcher.LaunchFileAsync(IStorageFile, LauncherOptions) ### Description Launches the specified file, allowing the user to choose the application if `DisplayApplicationPicker` is set to true. ### Method `async Task LaunchFileAsync(IStorageFile file, LauncherOptions options)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```csharp // C# Example var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile); if (file != null) { var options = new Windows.System.LauncherOptions(); options.DisplayApplicationPicker = true; bool success = await Windows.System.Launcher.LaunchFileAsync(file, options); } ``` ### Response #### Success Response (200) - **success** (boolean) - Returns true if the file was launched successfully, false otherwise. #### Response Example ```json // Boolean indicating success or failure of the launch operation true ``` ### Remarks - The calling app must be visible to the user. - This API must be called from within an ASTA thread (UI thread). - Certain file types (e.g., .exe, .msi, .js) are blocked from launching to protect users. - If the launch fails due to restrictions, the API returns `false`. - Set `LauncherOptions.DisplayApplicationPicker` to `true` to enable the user to choose an app. - Set `LauncherOptions.TreatAsUntrusted` to `true` to display a warning that the file is potentially unsafe. - Files are passed to the associated app using shell execution mechanisms if the app is a desktop app. ``` -------------------------------- ### C# Example Usage Source: https://learn.microsoft.com/en-us/uwp/api/windows.system.inventory.installeddesktopapp.getinventoryasync Iterates through the list of installed desktop applications and prints their display name, ID, publisher, and version. This snippet demonstrates how to use the GetInventoryAsync method to retrieve and process installed app information. ```csharp IReadOnlyList installedApps = await InstalledDesktopApp.GetInventoryAsync(); foreach (var app in installedApps) { Console.WriteLine("Display Name: " + app.DisplayName); Console.WriteLine("Application ID: " + app.Id); Console.WriteLine("Publisher: " + app.Publisher); Console.WriteLine("Display Version: " + app.DisplayVersion); } ``` -------------------------------- ### Get UserActivity Session Start Time (C#) Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.useractivities.useractivitysessionhistoryitem.starttime Get the time when the user started engaging in the UserActivity associated with this UserActivitySessionHistoryItem. This is the C# syntax. ```csharp public System.DateTimeOffset StartTime { get; } ``` -------------------------------- ### Start Method Definition (C++/CLI) Source: https://learn.microsoft.com/en-us/uwp/api/Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementPublisher.Start The C++/CLI signature for the Start method. ```cpp void Start(); ``` -------------------------------- ### Get UserActivity Session Start Time (C++/WinRT) Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.useractivities.useractivitysessionhistoryitem.starttime Get the time when the user started engaging in the UserActivity associated with this UserActivitySessionHistoryItem. This is the C++/WinRT syntax. ```cppwinrt DateTime StartTime(); ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.inktoolbareraserbutton.isclearallvisible Gets or sets whether the "Erase all ink" button is visible. This example shows how to get and set the IsClearAllVisible property. ```csharp var boolean = inkToolbarEraserButton.isClearAllVisible; inkToolbarEraserButton.isClearAllVisible = boolean; ``` -------------------------------- ### Start Method Definition (C++/CLI) Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.advertisement.bluetoothleadvertisementwatcher.start The C++/CLI definition for the Start method of the BluetoothLEAdvertisementWatcher. ```cpp void Start(); ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.contacts.contactconnectedserviceaccount.servicename Example of getting and setting the service name for a connected service account. ```csharp var string = contactConnectedServiceAccount.serviceName; contactConnectedServiceAccount.serviceName = string; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.smartcards.smartcardcryptogramplacementstep.cryptogramplacementoptions Example of getting and setting the CryptogramPlacementOptions property. ```csharp var smartCardCryptogramPlacementOptions = smartCardCryptogramPlacementStep.cryptogramPlacementOptions; smartCardCryptogramPlacementStep.cryptogramPlacementOptions = smartCardCryptogramPlacementOptions; ``` -------------------------------- ### StartActivity with Fields, Level, and Options (C#) Source: https://learn.microsoft.com/en-us/uwp/api/windows.foundation.diagnostics.loggingactivity.startactivity Use this C# overload to start an activity, providing the event name, fields, logging level, and logging options. Pass null for options to use defaults. ```csharp [Windows.Foundation.Metadata.Overload("StartActivityWithFieldsAndOptions")] public LoggingActivity StartActivity(string startEventName, LoggingFields fields, LoggingLevel level, LoggingOptions options); ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.sensors.compassdatathreshold.degrees Example of getting and setting the Degrees property. ```csharp var double = compassDataThreshold.degrees; compassDataThreshold.degrees = double; ``` -------------------------------- ### Publish Binary Message to Launch an App (C#) Source: https://learn.microsoft.com/en-us/uwp/api/windows.networking.proximity.proximitydevice.publishbinarymessage This C# example demonstrates how to publish a binary message to launch an app using the ProximityDevice. Use this when you need to trigger another application on a proximate device. Ensure the ProximityDevice is obtained successfully before publishing. ```csharp Windows.Networking.Proximity.ProximityDevice proximityDevice; private void PublishLaunchApp() { proximityDevice = Windows.Networking.Proximity.ProximityDevice.GetDefault(); if (proximityDevice != null) { // The format of the app launch string is: "\tWindows\t". // The string is tab or null delimited. // The string must have at least one character. string launchArgs = "user=default"; // The format of the AppName is: PackageFamilyName!PRAID. string praid = "MyAppId"; // The Application Id value from your package.appxmanifest. string appName = Windows.ApplicationModel.Package.Current.Id.FamilyName + "!" + praid; string launchAppMessage = launchArgs + "\tWindows\t" + appName; var dataWriter = new Windows.Storage.Streams.DataWriter(); dataWriter.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf16LE; dataWriter.WriteString(launchAppMessage); var launchAppPubId = proximityDevice.PublishBinaryMessage( "LaunchApp:WriteTag", dataWriter.DetachBuffer()); } } ``` -------------------------------- ### C# Get and Set DatePicker.DayFormat Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.datepicker.dayformat Example of getting and setting the DayFormat property. ```csharp var string = datePicker.dayFormat; datePicker.dayFormat = string; ``` -------------------------------- ### Visual Basic Example: Deferred Play To Source Request Source: https://learn.microsoft.com/en-us/uwp/api/windows.media.playto.playtosourcerequest.getdeferral This Visual Basic example demonstrates how to handle a deferred Play To source request. It shows how to get a deferral, retrieve media asynchronously, set the source, and complete the deferral. ```vb Private ptm As Windows.Media.PlayTo.PlayToManager = Windows.Media.PlayTo.PlayToManager.GetForCurrentView() Protected Overrides Sub OnNavigatedTo(e As Navigation.NavigationEventArgs) AddHandler ptm.SourceRequested, AddressOf sourceRequestHandlerDeferred End Sub Private Async Sub sourceRequestHandlerDeferred( sender As Windows.Media.PlayTo.PlayToManager, e As Windows.Media.PlayTo.PlayToSourceRequestedEventArgs) Dim deferral = e.SourceRequest.GetDeferral() ' Async call to get source media Dim element = Await getMediaElementAsync() e.SourceRequest.SetSource(element.PlayToSource) deferral.Complete() End Sub ``` -------------------------------- ### C++ Get and Set Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.composition.compositionsurfacebrush.rotationangleindegrees Example of getting and setting the RotationAngleInDegrees property in C++. ```cpp float RotationAngleInDegrees(); void RotationAngleInDegrees(float value); ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.contacts.contactwebsite.description Example of getting and setting the description for a contact's website in C#. ```csharp var string = contactWebsite.description; contactWebsite.description = string; ``` -------------------------------- ### C# Get XpsContent Source: https://learn.microsoft.com/en-us/uwp/api/windows.graphics.printing.workflow.printworkflowsubmittedoperation.xpscontent Example of how to get the XpsContent from a PrintWorkflowSubmittedOperation object in C#. ```csharp var printWorkflowSourceContent = printWorkflowSubmittedOperation.xpsContent; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.networking.vpn.vpndomainnameinfo.domainname Provides a basic example of getting and setting the DomainName property in C#. ```csharp var hostName = vpnDomainNameInfo.domainName; vpnDomainNameInfo.domainName = hostName; ``` -------------------------------- ### C# HttpMethod.Post Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.web.http.httpmethod.post Example of how to get the HttpMethod.Post value in C#. ```csharp var httpMethod = HttpMethod.post; ``` -------------------------------- ### C# Usage Example for AppInstallManager.AppInstallItems Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.store.preview.installcontrol.appinstallmanager.appinstallitems Example of how to access the AppInstallItems property in C#. ```csharp var iVectorView = appInstallManager.appInstallItems; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.webviewbrush.sourcename Example of how to get and set the SourceName property in C#. ```csharp var string = webViewBrush.sourceName; webViewBrush.sourceName = string; ``` -------------------------------- ### C# Usage Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.appinstance.recommendedinstance Usage example for RecommendedInstance in C#. ```csharp var appInstance = AppInstance.recommendedInstance; ``` -------------------------------- ### Example Prefetch XML File Source: https://learn.microsoft.com/en-us/uwp/api/windows.networking.backgroundtransfer.contentprefetcher.indirectcontenturi Provides an example of a well-formed XML file that can be used with IndirectContentUri. It lists URIs of resources to be prefetched. ```xml http://example.com/2013-02-28-headlines.json http://example.com/2013-02-28-img1295.jpg http://example.com/2013-02-28-img1296.jpg ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.searchbox.choosesuggestiononenter Example of how to get and set the ChooseSuggestionOnEnter property in C#. ```csharp var boolean = searchBox.chooseSuggestionOnEnter; searchBox.chooseSuggestionOnEnter = boolean; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.progressbar.showerror Example of how to get and set the ShowError property in C#. ```csharp var boolean = progressBar.showError; progressBar.showError = boolean; ``` -------------------------------- ### Launch File with User Selection (C++/CX) Source: https://learn.microsoft.com/en-us/uwp/api/windows.system.launcher.launchfileasync Launches a file and allows the user to select the application from an "Open With" dialog using C++/CX. This example uses tasks for asynchronous operations and requires a UI thread. ```cppcx void MainPage::DefaultLaunch() { auto installFolder = Windows::ApplicationModel::Package::Current->InstalledLocation; concurrency::task getFileOperation(installFolder->GetFileAsync("images\test.png")); getFileOperation.then([](Windows::Storage::StorageFile^ file) { if (file != nullptr) { // Set the option to show the picker auto launchOptions = ref new Windows::System::LauncherOptions(); launchOptions->DisplayApplicationPicker = true; // Launch the retrieved file concurrency::task launchFileOperation(Windows::System::Launcher::LaunchFileAsync(file, launchOptions)); launchFileOperation.then([](bool success) { if (success) { // File launched } else { // File launch failed } }); } else { // Could not find file } }); } ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.primitives.jumplistitembackgroundconverter.enabled Example of how to get and set the Enabled property in C#. ```csharp var brush = jumpListItemBackgroundConverter.enabled; jumpListItemBackgroundConverter.enabled = brush; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.listpickerflyout.selectionmode Example of getting and setting the SelectionMode property in C#. ```csharp var listPickerFlyoutSelectionMode = listPickerFlyout.selectionMode; listPickerFlyout.selectionMode = listPickerFlyoutSelectionMode; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.handwritingview.placementalignmentproperty Example of how to get the PlacementAlignment dependency property in C#. ```csharp var dependencyProperty = HandwritingView.placementAlignmentProperty; ``` -------------------------------- ### PwmPin.Start Method Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.pwm.pwmpin.start Starts the PWM on this pin. This method is available across multiple Windows builds. ```APIDOC ## PwmPin.Start Method ### Description Starts the PWM on this pin. ### Method Signature ```csharp public void Start(); ``` ### Applies to - WinRT (Build 10240 and later) ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.combobox.selectionchangedtrigger Example of how to get and set the SelectionChangedTrigger property in C#. ```csharp var comboBoxSelectionChangedTrigger = comboBox.selectionChangedTrigger; comboBox.selectionChangedTrigger = comboBoxSelectionChangedTrigger; ``` -------------------------------- ### Example Usage Source: https://learn.microsoft.com/en-us/uwp/api/windows.globalization.fonts.languagefontgroup Demonstrates how to get and use font recommendations for Japanese traditional and modern documents. ```APIDOC ## Example Usage ### Description Demonstrates how to get and use font recommendations for Japanese traditional and modern documents. ### Code Example (C#) ```csharp // Get the recommended Japanese fonts for traditional documents and modern documents. var fonts = new Windows.Globalization.Fonts.LanguageFontGroup("ja-JP"); var traditionalDocumentFont = fonts.TraditionalDocumentFont; var modernDocumentFont = fonts.ModernDocumentFont; // Obtain two properties of the traditional document font. var traditionalDocumentFontFontFamily = traditionalDocumentFont.FontFamily; // "MS Mincho" var traditionalDocumentFontScaleFactor = traditionalDocumentFont.ScaleFactor; // 100 // Obtain two properties of the modern document font. var modernDocumentFontFontFamily = modernDocumentFont.FontFamily; // "Meiryo" var modernDocumentFontScaleFactor = modernDocumentFont.ScaleFactor; // 90 ``` ``` -------------------------------- ### C# Usage Example for DigitalWindowBounds.Scale Property Source: https://learn.microsoft.com/en-us/uwp/api/windows.media.devices.digitalwindowbounds.scale Example of getting and setting the scale property for DigitalWindowBounds. ```C# var double = digitalWindowBounds.scale; digitalWindowBounds.scale = double; ``` -------------------------------- ### C++ StagePackageOptions.InstallAllResources Property Source: https://learn.microsoft.com/en-us/uwp/api/windows.management.deployment.stagepackageoptions.installallresources Gets or sets a value that indicates whether the app skips resource applicability checks. ```cpp public: property bool InstallAllResources { bool get(); void set(bool value); }; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.composition.compositionviewbox.horizontalalignmentratio Example of getting and setting the HorizontalAlignmentRatio property in C#. ```csharp var single = compositionViewBox.horizontalAlignmentRatio; compositionViewBox.horizontalAlignmentRatio = single; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.security.cryptography.certificates.pfximportparameters.readername Example of getting and setting the ReaderName property in C#. ```csharp var string = pfxImportParameters.readerName; pfxImportParameters.readerName = string; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.storage.provider.storageprovidermoreinfoui.command Demonstrates how to get and set the Command property in C#. ```csharp var iStorageProviderUICommand = storageProviderMoreInfoUI.command; storageProviderMoreInfoUI.command = iStorageProviderUICommand; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.pointofservice.provider.paymentdeviceconnectorinfo.version Demonstrates how to get and set the Version property in C#. ```csharp var string = paymentDeviceConnectorInfo.version; paymentDeviceConnectorInfo.version = string; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.networking.connectivity.connectionprofilefilter.iswlanconnectionprofile Example of how to get and set the IsWlanConnectionProfile property in C#. ```csharp var boolean = connectionProfileFilter.isWlanConnectionProfile; connectionProfileFilter.isWlanConnectionProfile = boolean; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.media.streaming.adaptive.adaptivemediasourcedownloadresult.resourceuri Example of getting and setting the ResourceUri property in C#. ```csharp var uri = adaptiveMediaSourceDownloadResult.resourceUri; adaptiveMediaSourceDownloadResult.resourceUri = uri; ``` -------------------------------- ### Instantiate AppUriHandlerHost (Default) Source: https://learn.microsoft.com/en-us/uwp/api/windows.system.appurihandlerhost.-ctor Example of creating an instance of AppUriHandlerHost using its default constructor in C#. ```C# AppUriHandlerHost host = new AppUriHandlerHost(); ``` -------------------------------- ### Start Method Definition (C++/WinRT) Source: https://learn.microsoft.com/en-us/uwp/api/Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisementPublisher.Start The C++/WinRT signature for the Start method. ```cpp public: virtual void Start() = Start; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.media.speechrecognition.speechrecognizertimeouts.initialsilencetimeout Example of how to get and set the InitialSilenceTimeout property in C#. ```csharp var timeSpan = speechRecognizerTimeouts.initialSilenceTimeout; speechRecognizerTimeouts.initialSilenceTimeout = timeSpan; ``` -------------------------------- ### StartBringIntoViewWithOptions Source: https://learn.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.MenuFlyoutItem Initiates a request to the XAML framework to bring the element into view using the specified options. ```APIDOC ## StartBringIntoView(BringIntoViewOptions) ### Description Initiates a request to the XAML framework to bring the element into view using the specified options. ### Method (Implicitly a method call on a UIElement instance) ### Parameters #### Path Parameters - **BringIntoViewOptions** (BringIntoViewOptions) - The options to use when bringing the element into view. ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.media.protection.playready.playreadydomainjoinservicerequest.domainserviceid Example of getting and setting the DomainServiceId property in C#. ```csharp var guid = playReadyDomainJoinServiceRequest.domainServiceId; playReadyDomainJoinServiceRequest.domainServiceId = guid; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.media.effects.videotransformsphericalprojection.horizontalfieldofviewindegrees Example of getting and setting the HorizontalFieldOfViewInDegrees property in C#. ```csharp var double = videoTransformSphericalProjection.horizontalFieldOfViewInDegrees; videoTransformSphericalProjection.horizontalFieldOfViewInDegrees = double; ``` -------------------------------- ### StartBringIntoViewWithOptions Source: https://learn.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.UIElement Initiates a request to the XAML framework to bring the element into view using the specified options. ```APIDOC ## StartBringIntoView(BringIntoViewOptions) ### Description Initiates a request to the XAML framework to bring the element into view using the specified options. ### Method StartBringIntoView ### Parameters #### Path Parameters - **options** (BringIntoViewOptions) - Required - The options to use for bringing the element into view. ``` -------------------------------- ### C++/WinRT Usage Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.appinstance.recommendedinstance Usage example for RecommendedInstance in C++/WinRT. ```cppwinrt static AppInstance RecommendedInstance(); ``` -------------------------------- ### Launch File Example - C++/CX Source: https://learn.microsoft.com/en-us/uwp/api/windows.system.launcher.launchfileasync Launches a file contained in the app package using the LaunchFileAsync(IStorageFile) overload. Ensure the file exists in the app's installed location. ```cpp void MainPage::DefaultLaunch() { auto installFolder = Windows::ApplicationModel::Package::Current->InstalledLocation; concurrency::task getFileOperation(installFolder->GetFileAsync("images\\test.png")); getFileOperation.then([](Windows::Storage::StorageFile^ file) { if (file != nullptr) { // Launch the retrieved file concurrency::task launchFileOperation(Windows::System::Launcher::LaunchFileAsync(file)); launchFileOperation.then([](bool success) { if (success) { // File launched } else { // File launch failed } }); } else { // Could not find file } }); } ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.graphics.printing3d.printing3dmesh.triangleindicesdescription Example of getting and setting the TriangleIndicesDescription property in C#. ```csharp var printing3DBufferDescription = printing3DMesh.triangleIndicesDescription; printing3DMesh.triangleIndicesDescription = printing3DBufferDescription; ``` -------------------------------- ### Enumerate Controller Properties Source: https://learn.microsoft.com/en-us/uwp/api/windows.gaming.input.preview.legacygipgamecontrollerprovider.fromgamecontroller This C# example demonstrates how to iterate through gamepads, create a LegacyGipGameControllerProvider, and access various properties and methods related to GIP controllers, such as battery status, firmware corruption, and interface support. It also shows how to set the Home LED intensity. ```csharp public void EnumerateControllerProperties() { foreach (Gamepad gamepad in Gamepad.Gamepads) { // Create the provider LegacyGipGameControllerProvider legacyGipGameControllerProvider = LegacyGipGameControllerProvider.FromGameController(gamepad); if (legacyGipGameControllerProvider == null) { // Not every gamepad is a legacy GIP game controller, continue enumerating continue; } // Check properties GameControllerBatteryChargingState chargeState = legacyGipGameControllerProvider.BatteryChargingState; GameControllerBatteryKind batteryKind = legacyGipGameControllerProvider.BatteryKind; GameControllerBatteryLevel batteryLevel = legacyGipGameControllerProvider.BatteryLevel; bool isOldFirmwareCorrupted = legacyGipGameControllerProvider.IsFirmwareCorrupted; bool isNewFirmwareCorrupted = legacyGipGameControllerProvider.GetDeviceFirmwareCorruptionState() != GameControllerFirmwareCorruptReason.NotCorrupt; bool isSynthetic = legacyGipGameControllerProvider.IsSyntheticDevice; byte[] extendedDeviceInfo = legacyGipGameControllerProvider.GetExtendedDeviceInfo(); // Check for a particular GIP interface bool supportsSomeCustomInterface = legacyGipGameControllerProvider.IsInterfaceSupported( new Guid( 0xaaaaaaaa, 0xbbbb, 0xcccc, 0xe, 0xf, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6)); IReadOnlyList preferredTypes = legacyGipGameControllerProvider.PreferredTypes; bool isGamepad = preferredTypes.Contains("Windows.Xbox.Input.Gamepad"); bool isHeadset = preferredTypes.Contains("Windows.Xbox.Input.Headset"); // Change the LED to half brightness legacyGipGameControllerProvider.SetHomeLedIntensity(50); } } ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.graphics.printing.printsupport.printsupportippcommunicationtimeouts.receivetimeout Example of how to get and set the ReceiveTimeout property in C#. ```csharp var timeSpan = printSupportIppCommunicationTimeouts.receiveTimeout; printSupportIppCommunicationTimeouts.receiveTimeout = timeSpan; ``` -------------------------------- ### Get Package Installation Progress (C++/CX) Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.packageinstallingeventargs.progress This property provides an approximation of the package's installation progress. The value is a double ranging from 0.0 to 1.0. ```cpp public: property double Progress { double get(); }; ``` -------------------------------- ### StartAdvertising() - C# Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.genericattributeprofile.gattserviceprovider.startadvertising Starts advertising the GATT service using C#. This overload does not take any parameters. ```csharp [Windows.Foundation.Metadata.Overload("StartAdvertising")] public void StartAdvertising(); ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.graphics.printing.printsupport.printsupportmxdcimagequalityconfiguration.draftoutputquality Example of how to get and set the DraftOutputQuality property in C#. ```csharp var xpsImageQuality = printSupportMxdcImageQualityConfiguration.draftOutputQuality; printSupportMxdcImageQualityConfiguration.draftOutputQuality = xpsImageQuality; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.globalization.numberformatting.decimalformatter.iszerosigned Example of getting and setting the IsZeroSigned property in C#. ```csharp var boolean = decimalFormatter.isZeroSigned; decimalFormatter.isZeroSigned = boolean; ``` -------------------------------- ### C# Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.media.casting.castingsource.preferredsourceuri Demonstrates getting and setting the PreferredSourceUri property in C#. Ensure you have a valid Uri object to assign. ```csharp var uri = castingSource.preferredSourceUri; castingSource.preferredSourceUri = uri; ``` -------------------------------- ### Transition Between Visual States in Visual Basic Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.visualstatemanager.gotostate This Visual Basic example demonstrates how to use the GoToState method to manage control states, similar to the C# version. Ensure correct syntax for Visual Basic. ```vb Private Sub UpdateStates(ByVal useTransitions As Boolean) If Value >= 0 Then VisualStateManager.GoToState(Me, "Positive", useTransitions) Else VisualStateManager.GoToState(Me, "Negative", useTransitions) End If If isFocused Then VisualStateManager.GoToState(Me, "Focused", useTransitions) Else VisualStateManager.GoToState(Me, "Unfocused", useTransitions) End If End Sub ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.globalization.calendaridentifiers.hebrew Example of how to get the Hebrew calendar identifier in C#. ```csharp var string = CalendarIdentifiers.hebrew; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.pointofservice.provider.paymentdeviceconnectiontriggerdetails.connection Example of how to access the payment device connection in C#. ```csharp var paymentDeviceConnection = paymentDeviceConnectionTriggerDetails.connection; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.pointofservice.barcodescannerimagepreviewreceivedeventargs.preview Example of how to get the IRandomAccessStreamWithContentType from the Preview property in C#. ```csharp var iRandomAccessStreamWithContentType = barcodeScannerImagePreviewReceivedEventArgs.preview; ``` -------------------------------- ### Start Method Definition (C++/WinRT) Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.advertisement.bluetoothleadvertisementwatcher.start The C++/WinRT definition for the Start method of the BluetoothLEAdvertisementWatcher. ```cpp public: virtual void Start() = Start; ``` -------------------------------- ### LaunchFileAsync(IStorageFile) Source: https://learn.microsoft.com/en-us/uwp/api/windows.system.launcher.launchfileasync Starts the default app associated with the specified file. This overload takes a single `IStorageFile` object as input. ```APIDOC ## LaunchFileAsync(IStorageFile) ### Description Starts the default app associated with the specified file. ### Method static IAsyncOperation ### Parameters #### Path Parameters * **file** (IStorageFile) - Required - The file to launch. ### Returns IAsyncOperation An asynchronous operation that returns a boolean indicating if the launch was successful. ### Examples #### C# ```csharp async void DefaultLaunch() { // Path to the file in the app package to launch string imageFile = @"images\test.png"; var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile); if (file != null) { // Launch the retrieved file var success = await Windows.System.Launcher.LaunchFileAsync(file); if (success) { // File launched } else { // File launch failed } } else { // Could not find file } } ``` #### C++/WinRT ```cppwinrt Windows::Foundation::IAsyncAction MainPage::DefaultLaunch() { // Get the app's installation folder. Windows::Storage::StorageFolder installFolder{ Windows::ApplicationModel::Package::Current().InstalledLocation() }; Windows::Storage::StorageFile file{ co_await installFolder.GetFileAsync(L"Assets\\LockScreenLogo.scale-200.png") }; if (file) { // Launch the retrieved file. bool success{ co_await Windows::System::Launcher::LaunchFileAsync(file) }; if (success) { // File launched. } else { // File launch failed. } } else { // Couldn't find file. } } ``` #### C++/CX ```cppcx void MainPage::DefaultLaunch() { auto installFolder = Windows::ApplicationModel::Package::Current->InstalledLocation; concurrency::task getFileOperation(installFolder->GetFileAsync("images\\test.png")); getFileOperation.then([](Windows::Storage::StorageFile^ file) { if (file != nullptr) { // Launch the retrieved file concurrency::task launchFileOperation(Windows::System::Launcher::LaunchFileAsync(file)); launchFileOperation.then([](bool success) { if (success) { // File launched } else { // File launch failed } }); } else { // Could not find file } }); } ``` #### VB ```vb async Sub DefaultLaunch() ' Path to the file in the app package to launch Dim imageFile = "images\test.png" Dim file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile) If file IsNot Nothing Then ' Launch the retrieved file Dim success = await Windows.System.Launcher.LaunchFileAsync(file) If success Then ' File launched Else ' File launch failed End If Else ' Could not find file End If End Sub ``` ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.display.core.displaymanagerpathsfailedorinvalidatedeventargs.handled Example of how to get and set the Handled property in C#. ```javascript var boolean = displayManagerPathsFailedOrInvalidatedEventArgs.handled; displayManagerPathsFailedOrInvalidatedEventArgs.handled = boolean; ``` -------------------------------- ### StartAdvertising(GattServiceProviderAdvertisingParameters) - C# Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.genericattributeprofile.gattserviceprovider.startadvertising Starts advertising the GATT service with specified parameters using C#. ```csharp [Windows.Foundation.Metadata.Overload("StartAdvertisingWithParameters")] public void StartAdvertising(GattServiceProviderAdvertisingParameters parameters); ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.genericattributeprofile.gattserviceprovideradvertisingparameters.servicedata Example of how to get and set the ServiceData property in C#. ```csharp var iBuffer = gattServiceProviderAdvertisingParameters.serviceData; gattServiceProviderAdvertisingParameters.serviceData = iBuffer; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.advertisement.bluetoothleadvertisementdatasection.datatype Example of getting and setting the DataType property in C#. ```csharp var byte = bluetoothLEAdvertisementDataSection.dataType; bluetoothLEAdvertisementDataSection.dataType = byte; ``` -------------------------------- ### StartAdvertising(GattServiceProviderAdvertisingParameters) - C++/WinRT Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.genericattributeprofile.gattserviceprovider.startadvertising Starts advertising the GATT service with specified parameters using C++/WinRT. ```cpp /// [Windows.Foundation.Metadata.Overload("StartAdvertisingWithParameters")] void StartAdvertising(GattServiceProviderAdvertisingParameters const& parameters); ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.data.xml.dom.xmlloadsettings.validateonparse Example of how to get and set the ValidateOnParse property in C#. ```csharp var boolean = xmlLoadSettings.validateOnParse; xmlLoadSettings.validateOnParse = boolean; ``` -------------------------------- ### JavaScript Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.data.pdf.pdfpagerenderoptions.isignoringhighcontrast Example of getting and setting the IsIgnoringHighContrast property in JavaScript. ```javascript var boolean = pdfPageRenderOptions.isIgnoringHighContrast; pdfPageRenderOptions.isIgnoringHighContrast = boolean; ``` -------------------------------- ### Registering and Managing App Hosts Source: https://learn.microsoft.com/en-us/uwp/api/windows.system.appurihandlerregistration.getappaddedhostsasync This C# example demonstrates how to retrieve, modify, and set the list of app hosts using GetAppAddedHostsAsync and SetAppAddedHostsAsync. It shows adding new domains and removing existing ones. ```csharp // Application logic can determine which are the new domains to register // Here we just have a hardcoded list. List hosts = await registration.GetAppAddedHostsAsync(); // Application logic can determine which are the new domains to register hosts.AddRange(new[] { new AppUriHandlerHost("www.contoso.com"), new AppUriHandlerHost("*.example.contoso.com") }); // Application logic can determine which domains to remove from the list hosts.RemoveAll(_ => _.Name == "removed.contoso.com"); await registration.SetAppAddedHostsAsync(hosts); ``` -------------------------------- ### JavaScript Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.wallet.walletverb.name Example of how to get and set the Name property in JavaScript. ```javascript var string = walletVerb.name; walletVerb.name = string; ``` -------------------------------- ### Launch File Example - C++/WinRT Source: https://learn.microsoft.com/en-us/uwp/api/windows.system.launcher.launchfileasync Launches a file contained in the app package using the LaunchFileAsync(IStorageFile) overload. Ensure the file exists in the app's installed location. ```cpp Windows::Foundation::IAsyncAction MainPage::DefaultLaunch() { // Get the app's installation folder. Windows::Storage::StorageFolder installFolder{ Windows::ApplicationModel::Package::Current().InstalledLocation() }; Windows::Storage::StorageFile file{ co_await installFolder.GetFileAsync(L"Assets\\LockScreenLogo.scale-200.png") }; if (file) { // Launch the retrieved file. bool success{ co_await Windows::System::Launcher::LaunchFileAsync(file) }; if (success) { // File launched. } else { // File launch failed. } } else { // Couldn't find file. } } ``` -------------------------------- ### C++/CX Constructor Source: https://learn.microsoft.com/en-us/uwp/api/windows.management.update.windowssoftwareupdateapppackageinfo.-ctor Initializes a new instance of WindowsSoftwareUpdateAppPackageInfo using C++/CX. ```cpp public: WindowsSoftwareUpdateAppPackageInfo(Platform::String ^ packageFamilyName, WindowsSoftwareUpdateArchitecture packageArchitecture, Uri ^ installUri); ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.socialinfo.socialuserinfo.username Example of getting and setting the UserName property in C#. ```csharp var string = socialUserInfo.userName; socialUserInfo.userName = string; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.payments.paymentoptions.requestpayerphonenumber Example of how to get and set the RequestPayerPhoneNumber property in C#. ```csharp var paymentOptionPresence = paymentOptions.requestPayerPhoneNumber; paymentOptions.requestPayerPhoneNumber = paymentOptionPresence; ``` -------------------------------- ### C# Example Usage of Binding.Path Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.data.binding.path Demonstrates how to get and set the Path property in C#. ```csharp var propertyPath = binding.path; binding.path = propertyPath; ``` -------------------------------- ### C# - Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.networking.networkoperators.knownusimfilepaths.gid2 Example of how to access the GID2 path in C#. ```csharp var iVectorView = KnownUSimFilePaths.gid2; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.calls.provider.phonecallorigin.category Example of getting and setting the category property in C#. ```csharp var string = phoneCallOrigin.category; phoneCallOrigin.category = string; ``` -------------------------------- ### C# Example Usage of SupportedDeviceClasses Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.enumeration.devicepickerfilter.supporteddeviceclasses Example of how to access the SupportedDeviceClasses property. ```csharp var iVector = devicePickerFilter.supportedDeviceClasses; ``` -------------------------------- ### StartAsync Source: https://learn.microsoft.com/en-us/uwp/api/windows.system.implementation.holographic.sysholographicwindowingenvironment Starts the holographic shell. This API is available only to components of the Windows operating system. ```APIDOC ## StartAsync() ### Description Starts the holographic shell. ### Important This API is available only to components of the Windows operating system. Calls to these APIs will fail at runtime for all other processes. These APIs may be modified or removed in future Windows releases. ``` -------------------------------- ### StartAdvertising() - C++/WinRT Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.genericattributeprofile.gattserviceprovider.startadvertising Starts advertising the GATT service using C++/WinRT. This overload does not take any parameters. ```cpp /// [Windows.Foundation.Metadata.Overload("StartAdvertising")] void StartAdvertising(); ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.applicationmodel.chat.chatsyncconfiguration.issyncenabled Example of how to get and set the IsSyncEnabled property in C#. ```csharp var boolean = chatSyncConfiguration.isSyncEnabled; chatSyncConfiguration.isSyncEnabled = boolean; ``` -------------------------------- ### StartBringIntoView with Options Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.shapes.line Initiates a request to the XAML framework to bring the element into view using the specified options. This method is inherited from UIElement. ```APIDOC ## StartBringIntoView ### Description Initiates a request to the XAML framework to bring the element into view using the specified options. This method is inherited from UIElement. ### Method (Inherited) ### Parameters * **options** (BringIntoViewOptions) - The options to use when bringing the element into view. ``` -------------------------------- ### Get DefaultContrast (C# - Usage) Source: https://learn.microsoft.com/en-us/uwp/api/windows.devices.scanners.imagescannerfeederconfiguration.defaultcontrast Example of how to get the default contrast value in C#. ```C# var int32 = imageScannerFeederConfiguration.defaultContrast; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.graphics.printing3d.printing3dcomponent.thumbnail Provides a basic example of retrieving and setting the thumbnail using C#. ```csharp var printing3DTextureResource = printing3DComponent.thumbnail; printing3DComponent.thumbnail = printing3DTextureResource; ``` -------------------------------- ### C# ClockIdentifier Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.timepickerflyout.clockidentifier Example of how to get and set the ClockIdentifier property in C#. ```csharp var string = timePickerFlyout.clockIdentifier; timePickerFlyout.clockIdentifier = string; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.composition.compositionninegridbrush.source Demonstrates how to get and set the Source property in C#. ```csharp var compositionBrush = compositionNineGridBrush.source; compositionNineGridBrush.source = compositionBrush; ``` -------------------------------- ### Load and Evaluate Model with Device Selection (C#) Source: https://learn.microsoft.com/en-us/uwp/api/windows.ai.machinelearning.learningmodeldevice.-ctor Loads a machine learning model and selects the device (CPU or GPU) for evaluation. Ensure the model file is in the application's Assets folder. ```csharp private async Task LoadModelAsync(string _modelFileName, bool _useGPU) { LearningModel _model; LearningModelSession _session; try { // Load and create the model var modelFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appx:///Assets/{_modelFileName}")); _model = await LearningModel.LoadFromStorageFileAsync(modelFile); // Select the device to evaluate on LearningModelDevice device = null; if (_useGPU) { // Use a GPU or other DirectX device to evaluate the model. device = new LearningModelDevice(LearningModelDeviceKind.DirectX); } else { // Use the CPU to evaluate the model. device = new LearningModelDevice(LearningModelDeviceKind.Cpu); } // Create the evaluation session with the model and device. _session = new LearningModelSession(_model, device); } catch (Exception ex) { StatusBlock.Text = $"error: {ex.Message}"; _model = null; } } ``` -------------------------------- ### C# Example Usage of SwipeItem.Foreground Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.swipeitem.foreground Example of getting and setting the Foreground brush for a SwipeItem. ```csharp var brush = swipeItem.foreground; swipeItem.foreground = brush; ``` -------------------------------- ### C# Usage Example for RatingItemImageInfo.UnsetImage Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.ratingitemimageinfo.unsetimage Example of how to get and set the UnsetImage property in C#. ```csharp var imageSource = ratingItemImageInfo.unsetImage; ratingItemImageInfo.unsetImage = imageSource; ``` -------------------------------- ### C# Example Usage of UriFormatString Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.maps.localmaptiledatasource.uriformatstring Example of getting and setting the UriFormatString property in C#. ```csharp var string = localMapTileDataSource.uriFormatString; localMapTileDataSource.uriFormatString = string; ``` -------------------------------- ### JavaScript Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.networking.sockets.streamwebsocketinformation.servercertificate Example of how to access the server certificate in JavaScript. ```javascript var certificate = streamWebSocketInformation.serverCertificate; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.media.protection.playready.playreadyindividualizationservicerequest.uri Demonstrates how to get and set the Uri property. Note that this property is not supported and will result in an error. ```csharp var uri = playReadyIndividualizationServiceRequest.uri; playReadyIndividualizationServiceRequest.uri = uri; ``` -------------------------------- ### C# Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.webui.webuiview.ignoreapplicationcontenturirulesnavigationrestrictions This C# example demonstrates how to get and set the IgnoreApplicationContentUriRulesNavigationRestrictions property. ```csharp var boolean = webUIView.ignoreApplicationContentUriRulesNavigationRestrictions; webUIView.ignoreApplicationContentUriRulesNavigationRestrictions = boolean; ``` -------------------------------- ### C# KeyFrameAnimation.DelayBehavior Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.composition.keyframeanimation.delaybehavior Example of how to get and set the DelayBehavior property in C#. ```csharp var animationDelayBehavior = keyFrameAnimation.delayBehavior; keyFrameAnimation.delayBehavior = animationDelayBehavior; ``` -------------------------------- ### LaunchUriAsync with Options (C#) Source: https://learn.microsoft.com/en-us/uwp/api/windows.system.remotelauncher.launchuriasync Starts the default app associated with the URI scheme name for the specified URI on a remote device, using the specified options with C#. ```csharp [Windows.Foundation.Metadata.Overload("LaunchUriWithOptionsAsync")] public static IAsyncOperation LaunchUriAsync(RemoteSystemConnectionRequest remoteSystemConnectionRequest, System.Uri uri, RemoteLauncherOptions options); ``` -------------------------------- ### C# SystemBackdrop Usage Example Source: https://learn.microsoft.com/en-us/uwp/api/windows.ui.composition.icompositionsupportssystembackdrop.systembackdrop Example of getting and setting the SystemBackdrop property in C#. ```C# var compositionBrush = iCompositionSupportsSystemBackdrop.systemBackdrop; iCompositionSupportsSystemBackdrop.systemBackdrop = compositionBrush; ```