Tag: uwp

x:UWP中缺少类型 – 如何覆盖基本控件样式?

在WPF中,我使用以下代码覆盖基本控件样式: 在UWP中, x:Type XAMl中的x:Type消失了。 那么如何在UWP中完成上述代码呢? 谢谢。

在Windows 10移动应用程序中使用黑色字体的黑色StatusBar

我有一个在移动设备上运行的Windows 10 UWP应用程序。 当我在模拟器中运行应用程序时,一切正常。 当我在设备(Lumia 550)上运行它时,StatusBar是黑色的,带有黑色字体,状态指示器不可见。 这是某种错误吗? 我知道我可以强制StatusBar有白色背景和黑色,但应用程序的要求是坚持主题(黑色主题中的黑色StatusBar,Light主题中的白色)。 如果我创建一个新的空Windows 10应用程序并在设备上运行它,问题是相同的,它不是我的应用程序特定的。

你能在UWP的C#代码中使用C ++ DLL吗?

我在Visual Studio中编写了一个C ++类库,它只定义了一个调用Python的函数: #pragma once #include extern “C” __declspec(dllexport) void python() { Py_Initialize(); PyRun_SimpleString(“2 + 2″); } 我在同一个C#Blank Universal应用程序的解决方案中创建了另一个项目。 我试图引用我提到的上一个项目生成的DLL: using System; … namespace StartupApp { … sealed partial class App : Application { private const string CPPPythonInterfaceDLL = @”pathtodll”; [DllImport(CPPPythonInterfaceDLL, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)] private static extern void python(); public static void […]

在CommandBar的SecondaryCommand上设置图标

我有一个命令栏宽度辅助命令: 为什么不显示喜欢和不喜欢的图标?

使用UWP TextBox.TextChanging来忽略错误的数据

我正在创建一个UWP应用程序,它具有不同的TextBoxes来输入数字。 为确保只能输入数字,我使用TextChanging事件。 遗憾的是,我找不到任何关于如何使用TextChanging来忽略错误输入的文档。 一个TextBox的工作解决方案如下: string oldText; private void tbInput_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args) { double temp; if (double.TryParse(sender.Text, out temp) || sender.Text == “”) oldText = sender.Text; else { int pos = sender.SelectionStart – 1; sender.Text = oldText; sender.SelectionStart = pos; } } 使用这个解决方案,我需要为每个TextBox提供一个string oldText ,并为每个TextBox提供一个TextChanging函数或者在函数内部有更多代码。 是否有一种简单的方法可以忽略TextBox.TextChanging事件中的“错误”输入?

UWP尝试使用附加的依赖属性动画滚动查看器

我试图在UWP中为scrollviewer的水平偏移设置动画。但附加的属性不会被动画目标识别。 这是c#代码 public class ScrollviewerBehaviour { public static readonly DependencyProperty Horizontalofsetproperty = DependencyProperty.RegisterAttached(“Horizontalofset”, typeof(double), typeof(ScrollviewerBehaviour), new PropertyMetadata(0,new PropertyChangedCallback(OnHorizontalofsetchanged))); public static void SetHorizontalofset(ScrollViewer element, double value) { element.SetValue(Horizontalofsetproperty, value); } public static double GetHorizontalofset(ScrollViewer element) { return (double)element.GetValue(Horizontalofsetproperty); } public static void OnHorizontalofsetchanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { var scrollviewer = (sender as ScrollViewer); scrollviewer.ChangeView((double)e.NewValue, scrollviewer.VerticalOffset, scrollviewer.ZoomFactor); […]

ListView ManipulationCompleted事件在手机上不起作用

我在Windows 10 UWP应用程序中有此代码: MyListView.ManipulationMode = ManipulationModes.TranslateX; MyListView.ManipulationStarted += (s, e) => x1 = (int)e.Position.X; MyListView.ManipulationCompleted += (s, e) => { x2 = (int)e.Position.X; if (x1 > x2) { DataController.PaneOpen(false); }; if (x1 < x2) { DataController.PaneOpen(true); }; }; ManipulationCompleted事件在ListView中无法在手机上运行。 处理程序中的代码永远不会被调用。 它在PC上工作正常,但在手机上不起作用。 我不明白为什么。

桌面上的UWP由顶部X按钮关闭 – 没有事件

在桌面上运行的UWP应用程序可以从顶部X按钮关闭,但它没有任何事件。 众所周知,在手机和平​​板电脑上,应用程序应该依赖Suspending事件,无论它是如何触发的,然后应用程序应该依赖于ApplicationExecutionState 。 然而,这是一个(可能)常见的场景:在手机上Suspending事件就足够了,如果正在进行Voip调用,它将在应用程序暂停后由OS操作。 在桌面上,用户希望关闭按钮完全关闭应用程序。 因此,如果正在进行呼叫,则应该挂起并且应该释放某些资源。 当(并且仅当)UWP应用程序在桌面上运行时,如何知道用户何时单击“关闭”按钮?

使用Visual Studio 2017.3编译Unity UWP构建时出错

我将Unity游戏移植到通用Windows平台。 但在Visual Studio 2017.3中创建构建期间,我收到此错误: 命令“”F:\ Games 4 \ Police Sniffer Dog ChaseV1.0 \ WinStore_10 \ Unity \ Tools \ AssemblyConverter.exe“-platform = uap -lock =”F:\ Games 4 \ Police Sniffer Dog ChaseV1.0 \ WinStore_10 \ Police Sniffer Dog Chase \ project.lock.json“-bits = 64 -configuration = Debug -removeDebuggableAttribute = False -path =”。“ – path =”.. \ Players […]

UWP app-installer自动更新无法正常工作

我正在尝试从远程源自动更新我的UWP应用程序。 为此我跟着这两个博客处理 – 自动更新-for-sideloaded-uwp-and-desktop-bridge-apps & create-appinstallerfile-vs MSDN。 我在版本1803(OS Build 17677.1000)中使用了它。 但是,我能够在每个其他版本上获得自动更新function(例如,如果我的第一个版本为0并且它是我首先安装的版本,那么我将获得版本1的自动更新,但不适用于版本2。如果我手动更新版本2然后再次获得版本3的自动更新。 每次应用程序在我的.appinstaller文件中运行时,我都会设置检查更新。 有人遇到过这个问题吗? 谁能告诉我一个解决这个问题的方法?