相关疑难解决方法(0)

如何将System.Windows.Interactivity添加到项目中?

我的项目遗失了System.Windows.Interactivity.谷歌说我必须安装Expression Blend,但是在我的另一台电脑上我有这个库,我没有安装Expression Blend.那么应该有另一种方式获得System.Windows.Interactivity?我该怎么办?(现在我没有另一台电脑所以我不能只复制这个库:)

c# wpf

73
推荐指数
8
解决办法
11万
查看次数

名称"交互"在名称空间"http://schemas.microsoft.com/expression/2010/interactivity"中不存在

我在几个项目中使用了System.Windows.Interactivity DLL而没有任何问题.现在在我的最新项目中,我无法让它发挥作用.我总是得到以下错误:

名称"交互"在名称空间" http://schemas.microsoft.com/expression/2010/interactivity " 中不存在.

<i:Interaction.Triggers>
    <EventTrigger EventName="SelectionChanged">
        <i:InvokeCommandAction Command="{Binding AddSelectLocomotifCommand}"
            CommandParameter="{Binding SelectedItem, ElementName=listBoxLocs}" />
    </EventTrigger>
</i:Interaction.Triggers>
Run Code Online (Sandbox Code Playgroud)

名称空间:

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
Run Code Online (Sandbox Code Playgroud)

双方Microsoft.Expression.InteractionsSystem.Windows.Interactivity添加到项目的引用,我甚至复制该DLL的一个文件夹我的项目中.

知道这是怎么来的吗?我使用VS2012和.NET 4.5

c# wpf visual-studio

35
推荐指数
5
解决办法
4万
查看次数

Windows 10 ScrollIntoView()不会滚动到列表视图中间的项目

我有一个包含20个项目的Listview.我想以编程方式滚动Listview.

ListView?.ScrollIntoView(ListView.Items[0])
Run Code Online (Sandbox Code Playgroud)

将列表视图滚动到第一个项目.

ListView?.ScrollIntoView(ListView.Items.Count - 1)
Run Code Online (Sandbox Code Playgroud)

将列表视图滚动到页面底部.

但是,我无法使用相同的功能将列表视图滚动到中间的项目.

Eg: ListView?.ScrollIntoView(ListView.Items[5])
Run Code Online (Sandbox Code Playgroud)

应该滚动并带我到列表的第5项.但它把我带到了列表的第一项.

如果通过一些解决方法可以实现这种行为,那会很棒吗?

c# xaml visual-studio windows-10 uwp

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

从C#转换为VB.NET的代码中的奇怪错误

可能重复: VB.NET中的方法组?

在阅读答案时我得到了这段代码:

public static class Helper
{
    public static bool GetAutoScroll(DependencyObject obj)
    {
        return (bool)obj.GetValue(AutoScrollProperty);
    }

    public static void SetAutoScroll(DependencyObject obj, bool value)
    {
        obj.SetValue(AutoScrollProperty, value);
    }

    public static readonly DependencyProperty AutoScrollProperty =
        DependencyProperty.RegisterAttached("AutoScroll", typeof(bool),
        typeof(Helper),
        new PropertyMetadata(false, AutoScrollPropertyChanged));

    private static void AutoScrollPropertyChanged(DependencyObject d,
        DependencyPropertyChangedEventArgs e)
    {
        var scrollViewer = d as ScrollViewer;

        if (scrollViewer != null && (bool)e.NewValue)
        {
            scrollViewer.ScrollToBottom();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

因为我在VB.NET工作,所以我转换它并获得:

Public NotInheritable Class Helper

    Private Sub New()
    End Sub

    Public Shared Function …
Run Code Online (Sandbox Code Playgroud)

c# vb.net dependency-properties

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

标签 统计

c# ×4

visual-studio ×2

wpf ×2

dependency-properties ×1

uwp ×1

vb.net ×1

windows-10 ×1

xaml ×1