相关疑难解决方法(0)

使用MVVM取消WPF中的组合框选择

我的WPF应用程序中有一个组合框:

<ComboBox  ItemsSource="{Binding CompetitorBrands}" DisplayMemberPath="Value" 
   SelectedValuePath="Key" SelectedValue="{Binding Path=CompMfgBrandID, Mode=TwoWay,
   UpdateSourceTrigger=PropertyChanged}" Text="{Binding CompMFGText}"/>
Run Code Online (Sandbox Code Playgroud)

绑定到的集合 KeyValuePair<string, string>

这是我的ViewModel中的CompMfgBrandID属性:

public string CompMfgBrandID
{
    get { return _compMFG; }
    set
    {    
        if (StockToExchange != null && StockToExchange.Where(x => !string.IsNullOrEmpty(x.EnteredPartNumber)).Count() > 0)
        {
            var dr = MessageBox.Show("Changing the competitor manufacturer will remove all entered parts from the transaction.  Proceed?",
                "Transaction Type", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (dr != DialogResult.Yes)
                return;
        }

        _compMFG = value;
        StockToExchange.Clear();

        ...a bunch of other functions that don't get called when you click …
Run Code Online (Sandbox Code Playgroud)

c# wpf combobox mvvm

25
推荐指数
4
解决办法
2万
查看次数

无法加载文件或程序集'System.Windows.Interactivity'

我刚刚添加了System.Windows.Interactivity程序集.XamlParse在运行时抛出异常:

无法加载文件或程序集'System.Windows.Interactivity,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一.该系统找不到指定的文件.

谷歌搜索只找到与棱镜相关的结果 - 我不使用.

知道为什么会这样吗?

.net c# wpf xaml exception

20
推荐指数
3
解决办法
2万
查看次数

标签 统计

c# ×2

wpf ×2

.net ×1

combobox ×1

exception ×1

mvvm ×1

xaml ×1