我试图在可视状态的VisualState.Setters中通过XAML更改控件的RelativePanel附加属性,但属性不会更改,因此我创建了一个依赖项属性,以便通过代码进行测试,两者都没有.
有没有办法刷新到一组新的值,如:
<VisualState.Setters>
<Setter Target="TimestablesControl.RelativePanel.RightOf" Value=""/>
<Setter Target="TimestablesControl.RelativePanel.AlignRightWithPanel" Value="false"/>
<Setter Target="TimestablesControl.RelativePanel.AlignLeftWithPanel" Value="true"/>
</VisualState.Setters>
Run Code Online (Sandbox Code Playgroud)
并使视图更"响应"?
xaml attached-properties win-universal-app windows-10 uwp-xaml
所以UWP Composition支持已经出现了一段时间我正在寻找一种方法来实时模糊元素(移动或加载时的实时模糊,而不是静态快照).到目前为止,我一直在看stackoverflow上的一些答案,谷歌引导我使用Lumia Imaging SDK Sample和Win2D.它们都不足以支持实时模糊.我知道在组合中可以实时模糊,因为我看过模糊视频的演示,并且有一个过时的项目XAMLFx,它允许你在8.1 Apps上使用DX模糊几乎任何东西.
我不想使用RenderTargetBitmap
(想保持我的UI线程免费).如何仅使用组合API来执行此操作:
ContainerVisual rootVisual = GetVisual(this.Content);
Compositor compositor = rootVisual.Compositor;
// what next?
Run Code Online (Sandbox Code Playgroud)
任何帮助是极大的赞赏 :)
我需要构建一个UWP应用程序,可以(手机/平板电脑)使用相机从电脑屏幕上读取QR条码.我需要在摄像头打开时检测QR条码,因为我不想截取(或类似)并将其保存到文件然后读取它.它需要在运行时检测.
是否有MIT许可证代码(在C#中)我可以在那里使用?
许多使用此功能的应用程序往往具有"目标"窗口,该窗口未使用整个屏幕.我怎样才能做到这一点?
有人能指出我正确的方向,我该怎么做?
非常感谢.
今天是个好日子.我正在创建我的Xamarin.Forms项目的UWP部分,我想在其中放入一个BackgroundImage.我注意到我在Xamarin.Forms.Droid中使用的图像没有显示在我的UWP上.为什么会这样?
我使用了这段代码BackgroundImage ="filename.jpg"
如何在UWP中将图标设置为TitleBar(Window)?
TitleBar图标示例:
我需要保持HeaderTemplate
一个的ListView
可见在任何时候,但我不知道该怎么设置,还是什么的一部分ListView
的模板更改为做到这一点.
我目前所拥有的是ListView
当向下滚动项目时导致标题滚动到顶部.
ListView
即使滚动浏览ListView
项目,如何保持可见的标题"行" ?
这是我的XAML:
<ListView x:Name="permitResults"
Grid.Row="1"
AutomationProperties.AutomationId="PermitResults"
AutomationProperties.Name="Permit Search Results"
ItemsSource="{Binding Source={StaticResource ResultsSource}}"
ItemClick="permitResults_ItemClick"
SelectionMode="None"
TabIndex="1"
Padding="0"
Margin="0"
BorderThickness="0"
IsSwipeEnabled="True"
IsItemClickEnabled="True"
ScrollViewer.VerticalScrollBarVisibility="Auto" >
<ListView.HeaderTemplate>
<DataTemplate>
<Grid Margin="0,0,0,0" Width="1366" Height="Auto" HorizontalAlignment="Left">
<Grid.Resources>
<Style TargetType="TextBlock" BasedOn="{StaticResource SearchGridResultsHeaderTextBlock}">
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="6*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Permit #" MaxLines="2" TextWrapping="WrapWholeWords"/>
<TextBlock Grid.Column="1" Text="County" …
Run Code Online (Sandbox Code Playgroud) 我在StackOverflow上找到的大多数问答都是Binding的工作原理,但x:Bind
通常不会解决这个问题Bindings.Update()
.但是,我的问题是,在内部GridView
,ItemSource="{x:Bind _myList}"
但有效ItemSource="{Binding _myList}"
.
为什么?我如何使Binding工作?(而不是x:Bind
)
这里有几个代码:
类:
public class MyClass
{
public string prop1 {get; set;}
public string prop2 {get; set;}
}
public class MyList : List<MyClass>
{
public void Populate()
// Add items
}
Run Code Online (Sandbox Code Playgroud)
代码背后
public MyList _myList = new MyList();
_myList.Populate();
DataContext = this;
Bindings.Update();
Run Code Online (Sandbox Code Playgroud)
XAML(在这里不起作用,但如果ItemSource:改为则可以工作x:Bind _myList
)
<GridView ItemSource="{Binding _myList}">
<GridView.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding prop1}"/> <TextBlock Text="{Binding prop2}/>
</StackPanel>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
Run Code Online (Sandbox Code Playgroud) 我正在尝试在UWP应用程序内的XAML-WebView控件中实现缩放到内容适配功能.由于缩放的半官方解决方案似乎是使用JavaScript,我的方法是动态设置zoom
body元素的CSS属性.
现在的问题是找到合适的缩放系数.
根据文档,WebView在文档模式下使用Edge浏览器.
但是,在Edge中,我发现document.body.clientWidth
-property总是返回文档宽度,无论窗口大小甚至缩放因子如何.因此,我使用设置缩放系数
document.body.style.zoom = (window.innerWidth * 100 / document.body.clientWidth) + '%'
Run Code Online (Sandbox Code Playgroud)
这适用于桌面IE11设置为IE10文档模式,在Edge和其他浏览器中,例如Chrome,基本上我测试的所有浏览器.但是,它不适WebView
用于应该在Windows 10 UWP应用程序中使用Edge的控件(感谢Jay Zuo的更新).
问题在于,在WebView
控制document.body.clientWidth
中,一旦设置,总是相同的,window.innerWidth
因此得到的缩放因子总是100%
,这是错误的.我想在用户调整窗口大小时重新缩放显示的页面.
有人知道可以使用哪种替代属性来获得WebView
控件中的首选文档宽度吗?
编辑:我要放大的网页的最小示例如下:
demo.html:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8">
<title>Demo</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="container">
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
style.css中:
@charset "utf-8";
body {
background-color: #FFF;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
overflow: hidden; …
Run Code Online (Sandbox Code Playgroud) 我有一个带NavigationView
控件的UWP应用程序.通过MenuItemsSource
在XAML中设置类型对象的集合来创建导航项NavigationViewElement
.
<NavigationView
Style="{StaticResource MainPageNavControlStyle}"
HeaderTemplate="{StaticResource MainPageNavHeaderTemplate}"
MenuItemsSource="{Binding NavigationViewElements}"
MenuItemContainerStyleSelector="{StaticResource NavStyleSelector}"
MenuItemTemplateSelector="{StaticResource NavItemTemplateSelector}"
x:Name="NavigationViewControl"
CompactModeThresholdWidth="480"
ExpandedModeThresholdWidth="635"
OpenPaneLength="324"
Loaded="OnControlLoaded"
ItemInvoked="OnItemInvoked"
IsTabStop="False"
IsSettingsVisible="False"
>
Run Code Online (Sandbox Code Playgroud)
我想绑定IsEnabled
的属性NavigationViewItems
是那些获得创建一个属性NavigationViewElement
.我怎么能这样做?
我有一个类似的问题ListBox
.在这种情况下,我能够从ListBox派生一个新类,它覆盖PrepareContainerForItemOverride()
并设置基于绑定到的类中的数据的IsEnabled
标志ListBoxItem
(在本例中为OptionItem)
protected override void PrepareContainerForItemOverride(Windows.UI.Xaml.DependencyObject element, object item)
{
ListBoxItem lItem = element as ListBoxItem;
OptionItem oItem = item as OptionItem;
if (lItem != null && oItem != null)
{
lItem.IsEnabled = oItem.IsEnabled;
}
base.PrepareContainerForItemOverride(element, item);
}
Run Code Online (Sandbox Code Playgroud)
是否有一个等价的 …
我已经查看了将 PivotItemHeader 样式应用于 UWP 中的 PivotItem,但我无法将这些建议应用于我的代码。
我正在尝试根据设备是桌面设备还是移动设备来更改 Pivot 中 PivotHeaderItem(s) 的样式。我的资源字典中有 2 个显式样式。
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Test">
<Style x:Key="PivotHeaderItemStyle1" TargetType="PivotHeaderItem">
<Style x:Key="PivotHeaderItemStyle2" TargetType="PivotHeaderItem">
</ResourceDictionary>
Run Code Online (Sandbox Code Playgroud)
我的 MainPage.xaml 是:
<Page
x:Class="Test.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Test"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary Source="Dictionary1.xaml"/>
</Page.Resources>
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="DeviceStates">
<VisualState x:Name="Desktop">
<VisualState.StateTriggers>
<local:DeviceStateTrigger DeviceFamily="Windows.Desktop"/>
</VisualState.StateTriggers>
<VisualState.Setters>
I don't know what to put here ---> <Setter Target="PivotHeaderItem1.Style" Value="{StaticResource PivotHeaderItemStyle1}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Mobile">
<VisualState.StateTriggers>
<local:DeviceStateTrigger DeviceFamily="Windows.Mobile"/>
</VisualState.StateTriggers>
<VisualState.Setters>
I don't know what to put here …
Run Code Online (Sandbox Code Playgroud) uwp-xaml ×10
c# ×6
uwp ×6
xaml ×4
composition ×1
directx ×1
listview ×1
titlebar ×1
windows-10 ×1
xamarin ×1