有没有一种方法来检测ScrollViwer的ListView是滚动模式,并停止滚动.在Windows Phone 8.1中,ListView我们无法获得scrollviewer的参考.
任何人在Windows Phone 8.1 WinRT应用程序中完成它?
xaml winrt-xaml windows-phone-8.1 win-universal-app winrt-xaml-toolkit
我有一个页面,我想使用WinRT Xaml Toolkit数据可视化控件放置图表.
我有以下代码:
<Charting:Chart x:Name="PieChart" Width="400" Height="400">
<Charting:Chart.Series>
<Charting:PieSeries IndependentValuePath="X" DependentValuePath="Y"/>
</Charting:Chart.Series>
</Charting:Chart>
Run Code Online (Sandbox Code Playgroud)
VS告诉我,PieSeries错了:"'PieSeries'类型的值不能添加到'Collection`1''类型的集合或字典中.
为什么这是一个错误?
我有一个涉及大量代码的问题,但我把它隔离了.如果你想要TL; DR; 进一步向下跳.如果你想要一点上下文,这是我的情况:
我为我的绑定创建了三个数据转换器.其中一个是"字符串前缀":它为使用固定字符串放入的任何内容添加前缀.在当前示例中,该固定字符串是"ms-appx:///cache/".第二个将string类型转换为a ImageSource,第三个将多个转换器链接在一起.
然后我创建了一个名为Xaml的资源LocalCacheFile.一切都按照您的想法运作.Xaml代码看起来像这样:
<Image Source="{x:Bind imageSource,Converter={StaticResource LocalCacheFile}}" />
Run Code Online (Sandbox Code Playgroud)
但是,我遇到了以下问题.如果我尝试使用FallbackValue为占位符图像设置imageSource为空时,我x:Bind只会出现奇怪的行为.
以下代码可以正常工作:
<Image Source="{Binding imageSource,FallbackValue='ms-appx:///Assets/default.png',Converter={StaticResource LocalCacheFile}}" />
Run Code Online (Sandbox Code Playgroud)
但
<Image Source="{x:Bind imageSource,FallbackValue='ms-appx:///Assets/default.png',Converter={StaticResource LocalCacheFile}}" />
Run Code Online (Sandbox Code Playgroud)
才不是!
我把它分离到只有一个转换器,它是DependencyProperty.UnsetValuex:Bind似乎没有处理.
TL; DR; 这是我的字符串前缀的代码,如果我单独使用它作为测试触发相同的错误行为:
public class StringPrefix : IValueConverter
{
public string prefix { get; set; }
public object Convert(object value, Type typeName, object parameter, string language)
{
if (value == DependencyProperty.UnsetValue || value == null || (string)value == "") …Run Code Online (Sandbox Code Playgroud) 如何在WinRT XAML Toolkit图表控件中更改图表控件的调色板颜色?
例如,我想更改饼图切片的颜色.
silverlight-toolkit windows-runtime winrt-xaml windows-store-apps winrt-xaml-toolkit
我想设置WinRT XAML Toolkit图表控件的图例项目的样式。
我检查了源代码,发现以下样式:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:datavis="using:WinRTXamlToolkit.Controls.DataVisualization">
<Style
TargetType="datavis:Legend">
<Setter
Property="BorderBrush"
Value="Black" />
<Setter
Property="BorderThickness"
Value="1" />
<Setter
Property="IsTabStop"
Value="False" />
<Setter
Property="TitleStyle">
<Setter.Value>
<Style
TargetType="datavis:Title">
<Setter
Property="Margin"
Value="0,5,0,10" />
<Setter
Property="FontWeight"
Value="Bold" />
<Setter
Property="HorizontalAlignment"
Value="Center" />
</Style>
</Setter.Value>
</Setter>
<Setter
Property="Template">
<Setter.Value>
<ControlTemplate
TargetType="datavis:Legend">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition
Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<datavis:Title
Grid.Row="0"
x:Name="HeaderContent"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
Style="{TemplateBinding TitleStyle}" />
<ScrollViewer
Grid.Row="1"
VerticalScrollBarVisibility="Auto"
BorderThickness="0"
Padding="0"
IsTabStop="False">
<ItemsPresenter …Run Code Online (Sandbox Code Playgroud) silverlight-toolkit windows-runtime winrt-xaml windows-store-apps winrt-xaml-toolkit