如何在Windows应用商店通用应用程序(W8.1 + WP8.1)中缩放文本?基本上,无论使用哪种设备/分辨率,应用程序看起来都应该相同.目前的情况是布局(基于动态网格的布局)和图像比文本(字体大小)更好地缩放.
显示的文字看起来很适合WVGA分辨率(480×800),但对于1080p分辨率来说却非常小.
我已经阅读了许多内容,例如 缩放到像素密度的指南或 支持多种屏幕尺寸的指南
但我仍然不知道如何扩展文本以保持可读性,无论显示分辨率/ DPI.
当然,我可以编写一个使用DisplayInformation.ResolutionScale属性将字体大小转换为适当值的类.
例:
但我不确定这是否适用于所有情况.有没有更好的方法呢?我认为这样的常见任务可以通过一些内置功能来执行.
免责声明:这是(希望)不是"让我谷歌这个为你问题"我发现大量的页面是关于缩放,但它们都覆盖布局或图像.但我找不到任何有关字体大小缩放的信息.如果我错过了什么,请原谅我.
xaml windows-8.1 windows-phone-8.1 win-universal-app windows-8.1-universal
我想知道如何在新的通用Windows应用程序平台中使用C#以编程方式获取特定于设备的信息.这是为了从旧的Windows窗体项目的现有C#代码到Windows 10中的UAP,获得一个简单的PC工具箱.
我希望安装(或可用)总RAM,CPU架构和ID /名称(例如64位Intel Core i5-XXXX),设备制造商和型号(Dell XPS XXXX)以及序列号/服务标签.
这是因为这些应用程序将使用Windows 10而且这个应用程序最初将面向传统PC,但我想扩展到具有有限功能的Windows Phone/Mobile(不确定如何/如果某些部件可以在ARM上运行) .我如何检测哪个版本的Windows 10,例如"Home","Pro","Enterprise","Mobile"或"Mobile Enterprise",以及32/64位和语言?
我现有的C#代码使用的库似乎不适用于Windows应用商店应用.
我对C#很生疏,但对任何类或参考文献的任何帮助都将不胜感激.我意识到获取存储所有这些规范的所有代码可能有点多(甚至可能是ATM),但是正确方向的指针会非常有用.
我正在尝试制作一个允许我拉出相机的项目,但我被告知每次程序运行时我都被拒绝访问相机.我从以下链接https://msdn.microsoft.com/en-us/library/windows/apps/mt243896.aspx阅读教程并对代码进行了一些小的更改,但更改不应影响结果
private MediaCapture _mediaCapture;
private bool _isInitialized;
private async Task InitializeCameraAsync()
{
if (_mediaCapture == null)
{
// Get available devices for capturing pictures
var allVideoDevices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);
// Get the desired camera by panel
DeviceInformation cameraDevice =
allVideoDevices.FirstOrDefault(x => x.EnclosureLocation != null &&
x.EnclosureLocation.Panel == Windows.Devices.Enumeration.Panel.Back);
// If there is no camera on the specified panel, get any camera
cameraDevice = cameraDevice ?? allVideoDevices.FirstOrDefault();
if (cameraDevice == null)
{
Debug.WriteLine("No camera device found.");
return;
}
// …Run Code Online (Sandbox Code Playgroud) 我正在创建一个在画布上绘制形状的应用程序,并使用https://github.com/phatware/WritePadSDK sdk将这些形状识别为字母用于书写板.但问题是这个api代码在Windows 8.1项目中使用时工作正常但是当在Windows 10通用应用程序中使用相同的代码时,它会在我调试代码时产生错误.下面给出了xaml代码
<Canvas Background="WhiteSmoke" Name="InkCanvas" PointerPressed="OnCanvasPointerPressed" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" PointerReleased="OnCanvasPointerReleased" PointerCaptureLost="OnCanvasPointerCaptureLost" PointerExited="InkCanvas_OnPointerExited" PointerMoved="OnCanvasPointerMoved" LostFocus="InkCanvas_LostFocus">
Run Code Online (Sandbox Code Playgroud)
并且在下面给出了使用sdk识别形状的代码,该代码在Canvas的PointerReleased事件上执行: -
var resultValue = recognizerShared.RecognizeStrokes(InkCanvas.Children.ToList(), false);
Run Code Online (Sandbox Code Playgroud)
当我检查sdk中给出的方法即RecognizeStrokes进行重新定位时,我在调试时遇到错误
由于此代码在Windows 8.1项目中正常工作,我认为它可能是Windows 10通用应用程序问题的东西
下面给出了Excelption的详细信息: -
AccessKey = 'new System.Collections.Generic.Mscorlib_CollectionDebugView<Windows.UI.Xaml.UIElement>(strokes).Items[0].AccessKey' threw an exception of type 'System.InvalidCastException'
Run Code Online (Sandbox Code Playgroud)
AccessKeyScopeOwner ='new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0] .AccessKeyScopeOwner'抛出类型'System.InvalidCastException'的异常
AllowFocusOnInteraction ='((Windows.UI.Xaml.FrameworkElement)new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0]).AllowFocusOnInteraction'抛出类型'System.InvalidCastException'的异常
AllowFocusWhenDisabled ='((Windows.UI.Xaml.FrameworkElement)new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0]).AllowFocusWhenDisabled'抛出类型'System.InvalidCastException'的异常
ContextFlyout ='new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0] .ContextFlyout'抛出类型'System.InvalidCastException'的异常
ExitDisplayModeOnAccessKeyInvoked ='new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0] .ExitDisplayModeOnAccessKeyInvoked'抛出类型'System.InvalidCastException'的异常
FocusVisualMargin ='((Windows.UI.Xaml.FrameworkElement)new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0]).FocusVisualMargin'抛出了类型'System.InvalidCastException'的异常
FocusVisualPrimaryBrush ='((Windows.UI.Xaml.FrameworkElement)new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0]).FocusVisualPrimaryBrush'抛出类型'System.InvalidCastException'的异常
new System.Collections.Generic.Mscorlib_CollectionDebugView(strokes).Items [0] .IsAccessKeyScope
请帮我解决上面的问题.
下载示例项目代码的链接如下所示,用于测试可以看到问题的位置
https://www.dropbox.com/s/1xbtxbxwyoyuf00/WindowsSDK.rar?dl=0
谢谢!
我向商店发布了一个Windows 10应用程序,其中包含相应的屏幕截图.
我现在为Windows 8.1 universal开发了相同的应用程序,屏幕截图与Windows 10应用程序不同.
如何上传Windows 8.1通用应用程序截图?
c# windows-8.1 windows-phone-8.1 win-universal-app windows-8.1-universal
我有一个看起来像这样的代码:
firstList = await GetFirstListFilesAsync();
textBlock1.Text = "found " + firstList.Count + " first list's results";
secondList = await GetSecondListFilesAsync();
textBlock2.Text = "found " + secondList.Count + " second list's results";
thirdList = await GetThirdListFilesAsync();
textBlock3.Text = "found " + thirdList.Count + " third list's results"
Run Code Online (Sandbox Code Playgroud)
所以现在它获得第一个列表,设置第一个TextBlock文本,然后获取第二个列表,设置第二个TextBlock文本,然后获取第三个列表并设置第三个TextBlock文本.但我希望所有等待操作同时运行,所以所有TextBlocks都会同时更新或更少.或者可能不是在同一时间 - 每个TextBlock都会在相应的await方法完成时更新.无论如何,我想在这里实现的目标是更快地获得结果.如果我一个接一个地运行这些方法,它们会等到上一个完成,但是如果它们同时运行,第三个方法会更快地返回结果,对吧?所以我的问题是 - 这可能吗?如果是,那怎么样?
场景:使用c#发往Windows 8.1/10(商店应用程序)的桌面,在UWP中开发"胖"客户端.
在我的用户界面中,我尝试使用以下内联
<StackPanel Grid.Column="0">
<TextBlock x:Name="Qty_Size_Crust" Margin="25,10,20,0" Padding="0,0,0,0" TextAlignment="Left" TextWrapping="Wrap" MaxHeight="25" Foreground="#ff230909" FontFamily="Segoe UI" FontSize="16" xml:space="preserve" HorizontalAlignment="Left">
if ({Binding WidgetName} == "Backend")
{
<Run Text="{Binding ItemCode, Converter=ItemCodeToDescriptionConverter}"/>
}
else
{
<Run Text="See Administrator}"/>
}
</TextBlock>
Run Code Online (Sandbox Code Playgroud)
编译器会接受这个,但在执行期间,我既看不到项目描述也看不到管理员.为了完成这项工作,还有什么我应该做的吗?我能够通过将代码放在ViewModel中来解决这个问题,但是想知道为什么这不起作用(或者可能不应该).
在MobileFirst Foundation中,将JSONStore添加到Windows 8.1 Universal环境会将以下文件添加到项目中:Msvcr110.dll
Sqllite3.dll
JSONStoreWin8Lib.dll
要创建包并验证它以进行发布,我使用Visual Studio在Windows 8本机中打开.sln文件,单击项目发布(project-> store-create application package)以启动该过程.
验证过程失败并显示错误:'msvcr110.dll不受支持'只有通过MS商店验证才会出现错误.
我该如何解决这个错误?