小编Kri*_*sic的帖子

以编程方式动画(平滑)ScrollViewer

有没有办法ScrollViewer在Windows Phone 8.1 Runtime中平滑地设置垂直偏移量?

我尝试过使用该ScrollViewer.ChangeView()方法,无论是否将disableAnimation参数设置为true或false,都不会对垂直偏移的更改进行动画处理.

例如:myScrollViewer.ChangeView(null, myScrollViewer.VerticalOffset + p, null, false); 偏移在没有动画的情况下更改.

我也试过使用垂直偏移中介:

/// <summary>
/// Mediator that forwards Offset property changes on to a ScrollViewer
/// instance to enable the animation of Horizontal/VerticalOffset.
/// </summary>
public sealed class ScrollViewerOffsetMediator : FrameworkElement
{
    /// <summary>
    /// ScrollViewer instance to forward Offset changes on to.
    /// </summary>
    public ScrollViewer ScrollViewer
    {
        get { return (ScrollViewer)GetValue(ScrollViewerProperty); }
        set { SetValue(ScrollViewerProperty, value); }
    }
    public static …
Run Code Online (Sandbox Code Playgroud)

c# windows-runtime winrt-xaml windows-phone-8.1

36
推荐指数
1
解决办法
5078
查看次数

Windows 10 Universal Apps中的事件记录器

我正在尝试为Windows Universal Application创建事件日志.早些时候我们不得不System.Diagnostics EventLog记录事件,但我在Windows 10 Universal Apps平台上找不到类似的东西.是否可以为Windows 10创建日志,是否可以将这些日志写入文件以便以后访问?

我搜索了很多,但找不到任何东西.

c# windows-runtime winrt-xaml win-universal-app windows-10

10
推荐指数
1
解决办法
6410
查看次数

ListBoxItem Horizo​​ntalContentAlignment在ListBox的整个宽度上拉伸

ListBoxItem在Windows Phone 8应用程序上遇到问题,同时试图让它们伸展到所有宽度ListBox.

我的ListBox:

<ListBox 
      ItemsSource="{Binding Events}" 
      behaviors:ItemClickCommandBehavior.Command="{Binding EventSelectedCommand}"
      ItemTemplate="{StaticResource EventListTemplateSelector}"/>
Run Code Online (Sandbox Code Playgroud)

它的DataTemplates在一个单独的xaml资源文件中:

<DataTemplate x:Key="EventListHeaderTemplate">
    <Border HorizontalAlignment="Stretch">
        <Grid Height="50">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="6*"/>
            </Grid.ColumnDefinitions>
            <Image Grid.Column="0" Source="{Binding ImageUri}" VerticalAlignment="Center" HorizontalAlignment="Center" Height="30"/>
            <TextBlock Grid.Column="1" Text="{Binding SomeText}" VerticalAlignment="Center" HorizontalAlignment="Left" Foreground="Black"/>
        </Grid>
    </Border>
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)

我不能让这些物品真正拉伸,我不知道问题出在哪里.我试图设置ItemContainerStyleHorizo​​ntalCOntentAlignment ="Stretch",但它不起作用.我已经尝试了许多其他组合,似乎只将Border或Grid宽度设置为常量工作,另一个有效的解决方案是将Border宽度设置为绑定到包含ListBox的ActualWidth,但我想使用Stretch变种如果可以使它工作.

xaml listbox alignment listboxitem windows-phone-8

9
推荐指数
1
解决办法
2660
查看次数

围绕'|'拆分java中的字符串 字符

我有这个

String str = "a,pnp,a|pnp,lab2|pnp,a|pnp,lab2,utr,utr";
String[] strings = str.split("|");
Run Code Online (Sandbox Code Playgroud)

这段代码不会围绕'|'拆分 相反,它会分割每个字符

strings[0] == "a";
strings[1] == ",";
Run Code Online (Sandbox Code Playgroud)

等等.

如何让这个工作得到

strings[0] == "a,pnp,a"
strings[1] == "pnp,lab2"
...
Run Code Online (Sandbox Code Playgroud)

java string split

1
推荐指数
1
解决办法
125
查看次数

当Object是Java中方法的返回类型时,返回特定类型

我有一个方法,getValue像这样的

public Object getValue() {
     return Integer.valueOf(0);
Run Code Online (Sandbox Code Playgroud)

}

和主方法中的调用:

getValue() + 5;
Run Code Online (Sandbox Code Playgroud)

这是简化的.

如何在不使用main方法进行转换的情况下使其工作,而是如果可能的话如何转换返回类型?

java methods return object

0
推荐指数
1
解决办法
9620
查看次数