Tag: windows 10

绑定与x:绑定,使用StaticResource作为默认值以及它们在DataContext中的差异

我花了半天时间尝试使用UserControl创建ListView的ItemTemplate ,并通过所述UserControl上的DependencyProperty进行配置。 关于Windows 10 UAP平台上可用的两种不同Binding方法( Binding和x:Bind ),我遇到了一些奇怪的不一致。 UserControl看起来像这样,是自定义日历组件的一部分。 EventItemTemplate是UserControl的DependencyProperty 。 public DataTemplate EventItemTemplate { get { return (DataTemplate)GetValue(EventItemTemplateProperty); } set { SetValue(EventItemTemplateProperty, value); } } public static readonly DependencyProperty EventItemTemplateProperty = DependencyProperty.Register(“EventItemTemplate”, typeof(DataTemplate), typeof(CalendarDayView), new PropertyMetadata(null)); 在其中一个根页面上进行了更改,以便以某种方式设置ListView样式,就像这样。 这实际上是一个工作版本,但我不得不修补它。 我使用x:Bind和Binding进行了第一次尝试,而在RelativePanel上没有DataContext ,因为现在是UserControl 。 x:Bind在根页面EventItemTemplate值设置为EventItemTemplate时, x:Bind将起作用,但是当根页面未指定任何内容时,它将无法使用StaticResource指定的默认DataTemplate 。 另一方面, Binding将始终使用默认的DataTemplate ,即使根页面设置了EventItemTemplate的其他值EventItemTemplate 。 通过将RelativePanel上的DataContext设置为UserControl Binding开始工作就像想要它一样。 x:Bind仍显示相同的行为。 现在我明白Binding默认情况下不会绑定到UserControl的DataContext ,但我仍然不完全确定为什么x:Bind不起作用。 这是预期的行为,还是我的整个计划出现了问题,是我想出的一个幸运的黑客行为?

Windows 10 Home / Pro / Enterprise上的IIS并发请求限制

我用SignalR(WebSockets)开发了一个ASP.Net Web应用程序。 我在Windows 10 Home Machine上的IIS上安装了它。 由于SignalR使用服务器和客户端之间的持久连接,因此我遇到的问题是此设置只能处理3个连接。 Windows 10 Pro或Windows 10 Enterprise上IIS 8.5的并发连接限制是多少? 是否还有其他选项可以在家中托管此应用程序,而无需安装Windows Server?

在Windows 10上使用Clipboard.GetImage()后从屏幕截图中删除文本?

这是一个奇怪的问题:我最近将我的工作站从Windows 7升级到Windows 10.我有一个聊天客户端,它使用下面的代码从剪贴板接受图像: if (Clipboard.ContainsImage()) { BitmapSource source = Clipboard.GetImage(); BitmapFrame frame = BitmapFrame.Create(source); var encoder = new System.Windows.Media.Imaging.PngBitmapEncoder(); encoder.Frames.Add(frame); var stream = new MemoryStream(); encoder.Save(stream); byte[] daten = stream.ToArray(); if (daten != null && daten.Length > 0) { sendFile(DateTime.Now.ToString(“yyyyMMddHHmmss_”) + “clipboard.png”, stream.ToArray()); } } 以下是我截图的区域应该是什么样的(例如,如果我将其粘贴到MS-Paint中或直接从截取工具保存): 在使用Clipboard.GetImage();导入屏幕截图后,现在看起来就像这样Clipboard.GetImage(); 。 如您所见,所有文本都被删除,如果您仔细观察,您会发现正常的白色背景现在是透明的。 如果我使用JpegBitmapEncoder而不是PngBitmapEncoder ,它工作正常,所以这是一个编码问题,但是让我感到困惑的是: 这在Windows 7上从未发生过 – Windows […]

在应用程序外的Win10中使用C#发送Key Strokes

我试图将一个简单的”CTRL+C”笔划发送到另一个窗口。 想法是从IE/FF/Chrome/IE/Excel/Word获取文本。 无论如何,我试图使用SendKeys.Send()和SendKeys.SendWait()以及InputSimulator的Keyboard.KeyPress() 。 他们都没有抛出exception(好的SendKeys.Send() ,但这是预期的)但它们实际上都没有发送任何东西。 我试图发送信件,但没有任何反应。 我将包含代码片段,看看我是否正在做一些真正密集的事情,但我担心它是一个Win10隔离的东西。 有没有人有幸在Win10中自己的应用程序之外发送击键呢? 的SendKeys: public void DoItDamnYou() { SendKeys.SendWait(“C”); MessageBox.Show(“Press SHOULD have happened”); } InputSimulator public void DoItDamnYouNow() { InputSimulator input = new InputSimulator(); input.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.VK_D); MessageBox.Show(“Now we are in the wrapper.”); } 如果有人有任何想法我会非常感激他们。 谢谢

C#windows 10 app中的ssh连接

我一直在寻找能够帮助我解决这个问题的2天。 我需要一种从Windows 10 Universal应用程序连接到ssh服务器的方法。 这意味着普通的ssh库不起作用,并且tcpclient不存在。 我怎样才能做到这一点? 提前致谢。

UWP – .NET本机工具链编译错误

我开发了一个简单的小型通用Windows应用程序,它使用EF7和SQLite。 当取消选中 “使用.NET Native工具链编译 ”选项时,它可以编译并顺利运行。 如果我选中 “使用.NET Native工具链编译 ”选项 ,则会出现以下编译错误: 错误类型’System.MarshalByRefObject’未包含在编译中,但在“Microsoft.Data.Entity.Design.OperationExecutor”类型中引用。 可能有一个组装缺失。 在此之后还有很多其他错误,但我相信解决这个错误也会照顾其余的错误。 有谁知道如何解决这个问题?

升级到Windows 10后WMI无法正常工作

我一直在Windows 8上使用Visual Studio中的控制台应用程序的代码来返回连接的串行设备的描述和设备ID。 我在我正在创建的应用程序中使用这个的修改版本来自动检测Arduino的COM端口。 自从我使用Windows 10进行全新安装后,它不再返回任何内容。我有一个USB转串口AVR程序员,但仍然显示使用此代码。 我检查了注册表,Arduino列在SERIALCOMM中,Arduino在Device Manager中的’Ports(COM&LPT)’下显示为’USB Serial Port(COM6)’,我可以使用Arduino软件对Arduino进行编程。 我不知道它为什么不再工作了。 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Management; using System.IO.Ports; using System.Diagnostics; namespace ConsoleApplication1 { class Program { static void Main() { ManagementScope connectionScope = new ManagementScope(); SelectQuery serialQuery = new SelectQuery(“SELECT * FROM Win32_SerialPort”); ManagementObjectSearcher searcher = new ManagementObjectSearcher(connectionScope, […]

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上工作正常,但在手机上不起作用。 我不明白为什么。

在ScrollViewer(UWP)中移动图像

我在Scrollviewer有一张Image …… 当我用鼠标指针拖动图像时,我想移动图像! 我试过了: private void Img_PointerPressed(object sender,PointerRoutedEventArgs e) { var p = e.Pointer; } 但我无法获得指针位置来改变scrollviewer位置。 我的代码出了什么问题? 我做得对吗?

FromBluetoothAddressAsync永远不会在WPF应用程序中的Windows 10 Creators Update上返回

我升级到Windows 10,版本1703 build 15063(Creators Update)正式发布。 当我在WPF桌面应用程序中运行以下代码时,BluetoothLEDevice.FromBluetoothAddressAsync永远不会返回。 在我的Windows 10更新(即之前的1607版本14393)之前,此代码工作正常。 如果它在新的Win 10 1703中作为UWP运行,该代码也可以正常工作。 BluetoothLEAdvertisementWatcher BleWatcher = null; private void Button_Click(object sender, RoutedEventArgs e) { BleWatcher = new BluetoothLEAdvertisementWatcher { ScanningMode = BluetoothLEScanningMode.Active }; BleWatcher.Received += Watcher_Received; BleWatcher.Start(); } private async void Watcher_Received(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args) { var device = await BluetoothLEDevice.FromBluetoothAddressAsync(args.BluetoothAddress); // never continues beyond this point […]