通用Windows平台是运行Windows 10的所有设备的通用软件平台。此标签应用于在任何支持的设备系列上开发UWP应用程序的问题。此外,应使用所使用语言的标签(C#,XAML),或者如果使用winjs,您还可以使用winjs标签。如果问题适用于设备系列,则还应使用特定设备标签(例如,windows-10-mobile)。
我正在使用 PickSingleFolderAsync() 来选择文件夹。 但文件夹对话框看起来像文件选择对话框。 这是我的代码。 私有异步无效 OpenFolder_Clicked() { varfolderPicker=新的Windows。
在我的 UWP 应用程序中,我为用户添加了 Azure AD 身份验证。用户可以正确登录。但是,一旦用户下次选中“保持登录”选项,只需单击 l...
为什么窗格标题与 UWP NavigationView 中的菜单项不对齐?
如下面的屏幕截图所示,窗格标题(“测试应用程序”)与菜单项不对齐,并且窗格标题和切换按钮之间存在无法解释的间隙...
UWP c# 在 ApplicationData.Current.LocalFolder 中创建文件返回 null
我创建了一个应用程序,需要将用户数据存储在应用程序启动时创建的文件中,当我编译它时,它向我显示此 System.IO.FileLoadException:无法找到或加载特定...
当 C++ winrt 页面类与 XAML 页面一起使用时,不是成员错误
我正在构建一个简单的 ActionTracker 程序。我有一个非常简单的 XAML 文件: //XAML文件 我正在构建一个简单的 ActionTracker 程序。我有一个非常简单的 XAML 文件: //XAML 文件 <Page x:Class="ActionTracker_V3.ActionDetails" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:ActionTracker_V3" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Grid> <TextBox Text="{x:Bind temp, Mode=OneWay}"></TextBox> </Grid> </Page> 支持运行时类定义为: //IDL 文件 namespace ActionTracker_V3 { runtimeclass ActionDetails : Windows.UI.Xaml.Controls.Page { ActionDetails(); String temp; } } 关联的*.h文件和*.cpp文件如下所示: #include "ActionDetails.g.h" namespace winrt::ActionTracker_V3::implementation { struct ActionDetails : ActionDetailsT<ActionDetails> { ActionDetails(); hstring temp(); void temp(hstring const& value); }; } namespace winrt::ActionTracker_V3::factory_implementation { struct ActionDetails : ActionDetailsT<ActionDetails, implementation::ActionDetails> {}; } *.cpp 文件是: #include "pch.h" #include "ActionDetails.h" namespace winrt::ActionTracker_V3::implementation { ActionDetails::ActionDetails() { InitializeComponent(); } hstring ActionDetails::temp() { throw hresult_not_implemented(); } void ActionDetails::temp(hstring const& value) { throw hresult_not_implemented(); } } 但是,当我编译这些文件时,出现以下错误: Error C2039 'ActionDetails': is not a member of 'winrt::ActionTracker_V3::implementation' ActionTracker_V3 c:\users\kurian.kattukaren\source\repos\actiontracker_v3\actiontracker_v3\generated files\xamltypeinfo.g.cpp 我不知道是什么原因导致了这个错误。我在类声明中找不到任何错误。有人可以指出我错在哪里吗? 根据对 C++/WinRT 问题进行故障排除中列出的故障排除步骤(稍微重新格式化): C++ 编译器产生错误“'implements_type':不是 '' 的任何直接或间接基类的成员”。 当您使用实现类型的名称空间非限定名称(例如,MyRuntimeClass)调用 make,并且尚未包含该类型的标头时,可能会发生这种情况。编译器将 MyRuntimeClass 解释为投影类型。 解决方案是包含您的实现类型的标头(例如,MyRuntimeClass.h)。 我复制上述信息只是想说,您的问题可能是由于编译器无法从您的项目中找到正确的标头。但这并不意味着您的代码有任何问题。有可能某些设置不正确,或者只是 Visual Studio 的问题。没有你的项目我也无法确定。如果这种情况在您的环境中总是发生,并且您确定您的代码是正确的,请直接从 Visual Studio->关于->向开发者社区论坛发送反馈来报告。 无论如何,任何时候如果你的项目出现奇怪的错误,你都可以先尝试一个新项目作为测试。
ArgumentException:使用 Windows.Media.Devices.FocusControl 时,值未落在预期范围内
我想使用Windows.Media.Devices.FocusControl手动控制HoloLens 2上的焦点值。但是当运行到“FocusControl.Configure(FocusSettings)”或“FocusCon...”功能时
当我从 XBOX 上的“游戏和应用程序”选项卡重新启动应用程序时出现焦点导航问题
当我使用“远程机器”方法从 XBOX 控制台上的 Visual Studio 启动应用程序时,我可以使用游戏手柄进行导航并能够获取“KeyDown”e...
我正在使用VS2022上的WebView方法为XBOX开发UWP应用程序。 我正在使用 addEventListener 方法来侦听按下任何按钮时触发的所有 keyDown 事件...
我正在尝试在我的应用程序中创建一个设置菜单,如下所示 我知道该怎么做,但我对内容对话框的宽度有疑问,显然宽度有限制。 这是我的内容的代码
如何修改 Unity 3D 输入字段以支持 Windows 10 中的触摸键盘滑动和预测?
在我的 Windows 独立 Unity 3D 版本中,我遇到了输入字段问题。当尝试使用触摸键盘输入字符时,我一次只能输入一个字符。
UWP 和 win32 应用程序之间共享 DirectX 纹理 2D
我正在尝试在 uwp 应用程序和 win32 应用程序之间设置共享纹理 2D。我在 UWP 应用程序中有以下代码: HRESULT 结果; D3D11_TEXTURE2D_DESC texDesc; texDesc.Width = 360; texDesc.He...
更改 CollectionView 中所选项目的背景颜色不适用于 UWP
我想更改所选项目的背景颜色。我已经尝试过以下解决方案,但它不起作用。 我想更改所选项目的背景颜色。我尝试过以下解决方案,但没有成功。 <CollectionView x:Name="FlexCategoryType" Margin="0" HorizontalOptions="FillAndExpand" ItemsSource="{Binding ItemsCategory}" SelectedItem="{Binding SelectedCategory, Mode=TwoWay}" SelectionChanged="FlexCategoryType_SelectionChanged" SelectionMode="Single"> <CollectionView.ItemTemplate> <DataTemplate> <StackLayout> <Label Text="{Binding Name}" /> <VisualStateManager.VisualStateGroups> <VisualStateGroup Name="CommonStates"> <VisualState Name="Normal" /> <VisualState Name="Selected"> <VisualState.Setters> <Setter Property="BackgroundColor" Value="Yellow" /> </VisualState.Setters> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </StackLayout> </DataTemplate> </CollectionView.ItemTemplate> </CollectionView> CollectionView SelectedItem 在 Xamarin Forms 中未突出显示 更改 CollectionView 中所选项目的背景颜色在 UWP 上不起作用 问题是你没有具体指定CollectionViewSelectionMode,默认值是none。请设置为Single。并添加 VisualStateGroups,如下所示 <CollectionView SelectionMode="Single"> <CollectionView.ItemTemplate> <DataTemplate> <StackLayout Margin="10"> <Label Text="{Binding}" VerticalOptions="Center" /> <VisualStateManager.VisualStateGroups> <VisualStateGroup Name="CommonStates"> <VisualState Name="Normal" /> <VisualState Name="Selected"> <VisualState.Setters> <Setter Property="BackgroundColor" Value="Yellow" /> </VisualState.Setters> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </StackLayout> </DataTemplate> </CollectionView.ItemTemplate> <CollectionView.ItemsSource> <x:Array Type="{x:Type x:String}"> <x:String>1</x:String> <x:String>2</x:String> <x:String>3</x:String> <x:String>4</x:String> <x:String>5</x:String> </x:Array> </CollectionView.ItemsSource> </CollectionView> 更新 如何更改ListView单元格选定的颜色。 这是FormsListViewItem样式,请将其复制到UWP App.xaml文件并编辑SelectedBackground为您想要的颜色。 例如 <Application.Resources> <ResourceDictionary> <Style x:Key="FormsListViewItem" TargetType="ListViewItem"> <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" /> <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" /> <Setter Property="Background" Value="Transparent" /> <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}" /> <Setter Property="TabNavigation" Value="Local" /> <Setter Property="IsHoldingEnabled" Value="True" /> <Setter Property="Padding" Value="0" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="MinWidth" Value="{ThemeResource ListViewItemMinWidth}" /> <Setter Property="MinHeight" Value="0" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListViewItem"> <ListViewItemPresenter CheckBrush="{ThemeResource SystemControlForegroundBaseMediumHighBrush}" ContentMargin="{TemplateBinding Padding}" CheckMode="Inline" ContentTransitions="{TemplateBinding ContentTransitions}" CheckBoxBrush="{ThemeResource SystemControlForegroundBaseMediumHighBrush}" DragForeground="{ThemeResource ListViewItemDragForegroundThemeBrush}" DragOpacity="{ThemeResource ListViewItemDragThemeOpacity}" DragBackground="{ThemeResource ListViewItemDragBackgroundThemeBrush}" DisabledOpacity="{ThemeResource ListViewItemDisabledThemeOpacity}" FocusBorderBrush="{ThemeResource SystemControlForegroundAltHighBrush}" FocusSecondaryBorderBrush="{ThemeResource SystemControlForegroundBaseHighBrush}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" PointerOverForeground="{ThemeResource SystemControlHighlightAltBaseHighBrush}" PressedBackground="{ThemeResource SystemControlHighlightListMediumBrush}" PlaceholderBackground="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" PointerOverBackground="{ThemeResource SystemControlHighlightListLowBrush}" ReorderHintOffset="{ThemeResource ListViewItemReorderHintThemeOffset}" SelectedPressedBackground="{ThemeResource SystemControlHighlightListAccentHighBrush}" SelectionCheckMarkVisualEnabled="True" SelectedForeground="{ThemeResource SystemControlHighlightAltBaseHighBrush}" SelectedPointerOverBackground="{ThemeResource SystemControlHighlightListAccentMediumBrush}" SelectedBackground="SeaGreen" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" /> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary> </Application.Resources>
C# 如何从 googlevideos.com/videoplayback url 下载音频文件
我有一个来自 YouTube 视频的音频格式的网址(示例) https://rr6---sn-n8v7znsr.googlevideo.com/videoplayback?expire=1691861737&ei=iW7XZM3hHciwv_IP3oe_oAk&ip=kekw&id=o-AH6t-
问题1: 我有一个如下的数据模板。在我的布局中,我需要将 ImagetipFrame 放在 TextBlocktipText 下方。 tipText 的文本将根据拉取的服务器文本而改变,因此tipFrame 的宽度
如何测试在 Windows 计算机上运行的 UWP 应用程序的缩放功能
我很抱歉,但我可能不得不问一个非常愚蠢的问题,因为我已经搜索了很长一段时间,似乎找不到我的问题的答案。我目前正在开发 Xamarin 跨平台...
UWP 是否有一个容器将包含许多其他对象并在它们超出容器时修剪它们
我需要一个容器(画布?),它将包含许多其他对象,并在它们越过容器时修剪它们,如下图所示。 如果您能提供源代码将会很有帮助。
如何使用按钮控件在 XAML 应用程序的不同页面之间导航。例如,您创建了一个登录表单,输入详细信息后,下一个菜单页面将显示 我尝试使用“。
我正在学习有关图像哈希的教程。 到目前为止我已经取得了以下成果: 代码: 私有异步任务 ProcessImageAsync(StorageFile ImageFile) { 如果(
UWP Display 在更改时无法更新 TextBlock 值
我有包含 TextBlock 的 UserControl。 我将此 UserControl 添加到 MainPage 中,然后每 1 秒更新一次 TextBlock。 我调试并看到 TextBlock 值已更改,但显示未显示...