小编Po-*_*ang的帖子

如何转换“MS.Internal.Data.CollectionViewGroupInternal”来使用?

我参考这种方式,并创建我的DataGrid.

但我在调用命令时需要使用参数。

我看到这是一种MS.Internal.Data.CollectionViewGroupInternal类型,但我不知道如何转换它。

“MS.Internal.Data.CollectionViewGroupInternal”有项目及其名称,我如何获取它?或者,我可以将我的参数绑定到CommandParameter,也许像SelectedItemof DataGrid,因为我有一个DependencyPropertyfor click Expander

public class ExpanderDataGrid : DataGrid
    {
        public string SelectedExpanderName
        {
            get
            {
                return (string)GetValue(SelectedExpanderNameProperty);
            }
            set
            {
                SetValue(SelectedExpanderNameProperty, value);
            }
        }

        public static readonly DependencyProperty SelectedExpanderNameProperty = DependencyProperty.Register("SelectedExpanderName",
                typeof(string), typeof(ExpanderDataGrid),
            new FrameworkPropertyMetadata("",
            FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
    }
Run Code Online (Sandbox Code Playgroud)

c# data-binding wpf datagrid

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

PlotView和Plot有什么区别?

我已经看到了两种图表用法,PlotViewPlot

如果使用PlotView,则只能使用Model="{Binding MyModel}",不能设置其他绑定,例如source。我无法实现MVVM。

但是,如果使用Plot,我可以进行任何绑定,并且xaml中的许多子控件设置都可以像seriesaxes等等。

我可以知道有什么不同吗?

c# wpf mvvm oxyplot

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

为什么 ConcurrentDictionary 有 AddOrUpdate 和 GetOrAdd,而 Dictionary 没有?

在 .NET Framework 中,有DictionaryConcurrentDictionary. 这些提供诸如Add,Remove等方法...

我知道当我们设计一个多线程程序时,我们使用ConcurrentDictionary来代替Dictionary线程安全。

我不知道为什么ConcurrentDictionaryAddOrUpdateGetOrAdd和类似的方法,同时Dictionary也没有。

我们总是喜欢下面的代码从 a 获取对象Dictionary

var dict = new Dictionary<string, object>();
object tmp;
if (dict.ContainsKey("key"))
{
       tmp = dict["key"];
}
else
{
       dict["key"] = new object();
       tmp = new object();
}
Run Code Online (Sandbox Code Playgroud)

但是在使用时ConcurrentDictionary,类似的代码只有一行。

var conDict = new ConcurrentDictionary<string, object>();
var tmp = conDict.GetOrAdd("key", new object());
Run Code Online (Sandbox Code Playgroud)

我希望 .NET 有这些方法,但为什么没有呢?

.net c# dictionary concurrentdictionary

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