问题标签 [uwp]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
2702 浏览

c# - How to get StackTrace without Exception in Windows Universal 10 App

I know it was possible to use:

but that seems to not work anymore, as it needs an Exception-Object.

0 投票
1 回答
2323 浏览

c# - 引用多个 API 扩展时,无法在“发布”中构建 W10 UWP 应用

在我的 Windows 10 通用应用程序中,我引用Windows Mobile Extensions for the UWPWindows Desktop Extensions for the UWP. 一切正常并在“调试”中编译,但在尝试在“发布”中编译时出现以下错误。当仅引用一个扩展时,该应用程序也会在“发布”中编译。

Fehler Der Befehl ""C:\Program Files (x86)\MSBuild\Microsoft.NetNative\x86\ilc\ilc.exe" /in:"C:\Users\myName\PROJECTS\myApp\myApp\obj\x86\Release \ilc\in" /out:"C:\Users\myName\PROJECTS\myApp\myApp\bin\x86\Release\ilc" /intermediatespath:"C:\Users\myName\PROJECTS\myApp\myApp\obj\x86 \Release\ilc\intermediate" /v:normal /keepintermediates:true /buildtype:ret /exename:"myApp.exe" /makepripath:"C:\Program Files (x86)\Windows Kits\10\bin\x64\MakePri .exe" /appPriProjectRoot:"C:\Users\myName\PROJECTS\myApp\myApp" /rcpath:"C:\Program Files (x86)\Windows Kits\10\bin\x86\rc.exe" /targetplatformsdklibpath:" C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\um" /targetplatformsdkmetadatapath:"C:\Users\myName\PROJECTS\myApp\myApp\obj\x86\Release\ilc\in\WinMetadata" /targetframeworkpath:"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319" /externalReferencePath:"C:\Program文件 (x86)\Windows Kits\10\References\Windows.ApplicationModel.Activation.ActivatedEventsContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.ApplicationModel.Activation。 ActivationCameraSettingsContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.ApplicationModel.Activation.ContactActivatedEventsContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86) \Windows Kits\10\References\Windows.ApplicationModel.Activation.WebUISearchActivatedEventsContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.ApplicationModel.Background.BackgroundAlarmApplicationContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.ApplicationModel. Calls.CallsPhoneContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.ApplicationModel.Calls.CallsVoipContract\1.0.0.0" /externalReferencePath:"C:\Program Files ( x86)\Windows Kits\10\References\Windows.ApplicationModel.Calls.LockScreenCallContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.ApplicationModel.CommunicationBlocking.CommunicationBlockingContract\ 1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.ApplicationModel.Resources.Management.ResourceIndexerContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.ApplicationModel.Search.Core.SearchCoreContract\1.0.0.0" /externalReferencePath:" C:\Program Files (x86)\Windows Kits\10\References\Windows.ApplicationModel.Search.SearchContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows. ApplicationModel.SocialInfo.SocialInfoContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.ApplicationModel.Wallet.WalletContract\1.0.0.0" /externalReferencePath:"C:\Program文件 (x86)\Windows Kits\10\References\Windows.Devices.Custom.CustomDeviceContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Devices.Portable.PortableDeviceContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Devices。 Printers.Extensions.ExtensionsContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Devices.Printers.PrintersContract\1.0.0.0" /externalReferencePath:"C:\Program文件 (x86)\Windows Kits\10\References\Windows.Devices.Scanners.ScannerDeviceContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Devices.SmartCards。 SmartCardBackgroundTriggerContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Devices.SmartCards.SmartCardEmulatorContract\1.0.0.0"/externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Devices.Sms.LegacySmsApiContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\ References\Windows.Embedded.DeviceLockdown.DeviceLockdownContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Gaming.Preview.GamesEnumerationContract\1.0.0.0" /externalReferencePath:" C:\Program Files (x86)\Windows Kits\10\References\Windows.Globalization.GlobalizationJapanesePhoneticAnalyzerContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Graphics. Printing3D.Printing3DContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Management.Deployment.Preview.DeploymentPreviewContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Management.Workplace.WorkplaceSettingsContract\1.0.0.0" /externalReferencePath:"C:\Program Files ( x86)\Windows Kits\10\References\Windows.Media.Capture.AppCaptureContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Media.Capture.CameraCaptureUIContract\ 1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Media.Devices.CallControlContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Media.MediaControlContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Media.Playlists。PlaylistsContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Media.Protection.ProtectionRenewalContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86) \Windows Kits\10\References\Windows.Networking.NetworkOperators.LegacyNetworkOperatorsContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Networking.NetworkOperators.NetworkOperatorsFdnContract\1.0。 0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Networking.Sockets.ControlChannelTriggerContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\ 10\References\Windows.Phone.PhoneContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Phone.StartScreen.DualSimTileContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Security. EnterpriseData.EnterpriseDataContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Security.ExchangeActiveSyncProvisioning.EasContract\1.0.0.0" /externalReferencePath:"C:\Program Files ( x86)\Windows Kits\10\References\Windows.Services.Maps.GuidanceContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.Services.Maps.LocalSearchContract\ 1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.System.Profile.ProfileHardwareTokenContract\1.0.0.0"/externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.System.Profile.ProfileRetailInfoContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\ References\Windows.System.Profile.SystemManufacturers.SystemManufacturersContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.System.UserProfile.UserProfileContract\1.0.0.0" /externalReferencePath :"C:\Program Files (x86)\Windows Kits\10\References\Windows.System.UserProfile.UserProfileLockScreenContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\ Windows.UI.ApplicationSettings.ApplicationsSettingsContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.UI.Core.AnimationMetrics.AnimationMetricsContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows. UI.Core.CoreWindowDialogsContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows.UI.WebUI.Core.WebUICommandBarContract\1.0.0.0" /externalReferencePath:"C: \Program Files (x86)\Windows Kits\10\References\Windows.UI.Xaml.Hosting.HostingContract\1.0.0.0" /externalReferencePath:"C:\Program Files (x86)\Windows Kits\10\References\Windows. Web.Http.Diagnostics.HttpDiagnosticsContract\1.0.0.0" /RdXmlPath:"C:\Program Files (x86)\MSBuild\Microsoft.NetNative\LibraryXML" /suppressPDBWarnings:true /AllowNoManagedCode /UseCustomFramework "/logger:CsvLogger;4288;2796"" wurde mit dem Code 1004 bedet。

0 投票
2 回答
311 浏览

c# - 可重复使用的拆分视图窗格?

我创建了一个简单的 SplitView,我想知道是否可以重用我的代码<SplitView.Pane>?这很简单,只有几个按钮,但我不想在不同的页面上一遍又一遍地包含相同的代码。

或者有没有办法对整个 SplitView 进行模板化,然后<SplitView.Content>在每个页面上进行修改?我更希望能够让按钮处理程序也是全局的,这样我就不会在每个页面 .cs 文件中编码相同的 3 个按钮。

最好的方法是什么?

编辑:这是针对 UWP Windows 10 应用程序的。

0 投票
1 回答
731 浏览

c++ - 在 UWP 应用中使用 DataTemplate 时出现问题(崩溃、未设置数据)

我正在尝试 Windows 10 UWP 应用程序开发。我已经安装了 Visual Studio 2015,目前正在尝试弄清楚如何使用数据绑定。

以下是我的简单 XAML:

这是我在相关部分的 Mainpage.xaml.cpp:(文档是一个简单的结构,它只有两个属性,一个字符串文件名和一个字符串内容。)

但是,我遇到了两个我无法弄清楚的问题:

第一个是,而不是每个 PivotItem 的标题Filename,它们都是 MyApp.Document,其中 MyApp 是我的命名空间。

第二个问题是,TextBox 已正确填充数据绑定中的内容,并且可以在两个 PivotItems 之间切换,但是一旦我尝试选择一个 Textbox,应用程序就会因访问冲突而崩溃:

在 MyApp.exe 中的 0x0004CE1E 处引发异常:0xC0000005:访问冲突读取位置 0x00000000。

关于我在这里做错了什么的任何意见?

0 投票
1 回答
430 浏览

xaml - 删除在 Windows 10 通用应用程序中不起作用的事件处理程序

嗨,我有一个动态创建的单击按钮,它将在 Windows 通用应用程序中下载视频,同时创建按钮我在事件处理程序上分配,如下所示:

一旦用户单击按钮,在 Download_Video 中,我将删除事件处理程序以下载视频,如下所示:

并分配一个新的事件处理程序以在单击相同按钮时播放视频,如下所示:

问题是先前分配的处理程序 Download_Video 也与 Video_Click 一起触发。如何阻止这种情况?

0 投票
2 回答
1022 浏览

xaml - Windows 10 UWP 中具有自定义附加属性的自适应触发器

我正在尝试在视觉状态中设置一个自定义附加属性,我尝试了几种使用完整命名空间的方法,没有使用别名等,但没有成功任何想法?

它不只是触发任何错误,我可以用 j: 替换 p: 并且它不会崩溃,我不知道如何解决这个问题。

这个问题是在这里完成解决方案: Relative width for UI Elements with RelativePanel in XAML with UWP Apps

0 投票
1 回答
792 浏览

c# - 在 Windows 10 通用应用程序中停止播放页面上的所有媒体元素

我正在创建动态媒体元素以及 xaml 页面上的动态按钮,如下所示:

然后单击按钮播放音频:

如何停止所有以前播放的媒体元素并一次只播放一个音频,因为有多个具有不同来源的媒体元素。

0 投票
1 回答
2037 浏览

c# - UWP:基于ScrollViewer计算变换

我有一个 Windows 通用应用程序,我在其中使用 DirectX 渲染场景。我想使用 Scrollviewer,因此我在 Scrollviewer 后面渲染我的场景,并希望根据 Scrollviewer 计算场景转换。到目前为止它工作正常,尤其是翻译和滚动。但是当我放大时,场景会在两种特殊情况下跳跃:

  1. 场景有足够的空间并且居中,现在需要滚动。
  2. 反方向。

我或多或少使用以下代码:

你可以在这里得到一个例子:https ://github.com/SebastianStehle/Win2DZoomTest

为了确保我的眼睛没有被打破,我正在四处放大并将翻译和缩放值写入文件。在这里你可以看到它:

https://www.dropbox.com/s/9ak6ohg4zb1mnxa/Test.png?dl=0

列的含义如下:

第 1 列:变换矩阵的计算缩放值 (M11) = ScrollViewer.ZoomFactor 第 2 列:矩阵的计算 x 偏移量(见上文) 第 3 列:矩阵 * 向量 (500, 500) 结果的 x 值,这里:列 1 * 500 + 列 2

您会看到,矩阵值看起来不错,但是在应用转换时,您会在几毫秒内向右跳动。一种理论是,视口可能会因为滚动条变得可见而改变。但这种情况并非如此。我还在这里尝试了固定值,使滚动条可见,甚至为滚动查看器创建了一个自定义模板,根本没有滚动条。

顺便说一句:这是一个交叉帖子,我在这里也问过这个问题:https ://github.com/Microsoft/Win2D/issues/125

0 投票
4 回答
51912 浏览

c# - 在桌面上为 Windows 10 UWP 应用设置窗口大小

我刚刚开始使用 Visual Studio 2015 Community Edition 在 Windows 10 Pro 上学习 UWP 应用开发。我尝试修改官方“Hello, World!”的C#版本 通过在 MainPage.xaml 中设置 Page 标记的WidthHeight属性来进行示例。

有趣的是,当我启动应用程序时,它的大小会有所不同。此外,如果我调整它的窗口大小然后重新启动它,应用程序似乎会记住它以前的窗口大小。

是否可以强制 UWP 应用程序具有预定义的窗口大小,至少在台式机上?

0 投票
1 回答
660 浏览

c++ - UWP/WinRT:如何在 TextBox 上启用撤消挂钩?

TextBox 类已经支持撤消,因为它在上下文菜单中存在并起作用。

我想实现每个常见文档编辑器(如 Microsoft Word)中的撤消/重做按钮。当它们没有要采取的操作时,它们将被禁用,并且当有一个撤消/重做堆栈要移动时,按下按钮将导致 TextBox 的内容撤消和重做。

查看TextBox API,似乎没有提到如何挂钩撤消数据。唯一的讨论是提到撤消存在于上下文菜单中。

如何在 TextBox 上实现撤消/重做挂钩?

如果它有所作为,我目前正在使用 C++/CX 进行编码。