小编Ani*_*jee的帖子

这种类型的CollectionView不支持从与Dispatcher线程不同的线程更改其SourceCollection

我有一个DataGrid,它通过异步方法从ViewModel填充数据.我的DataGrid是:

<DataGrid ItemsSource="{Binding MatchObsCollection}"  x:Name="dataGridParent" 
                      Style="{StaticResource EfesDataGridStyle}" 
                      HorizontalGridLinesBrush="#DADADA" VerticalGridLinesBrush="#DADADA" Cursor="Hand" AutoGenerateColumns="False" 
                      RowDetailsVisibilityMode="Visible"  >
Run Code Online (Sandbox Code Playgroud)

我正在使用http://www.amazedsaint.com/2010/10/asynchronous-delegate-command-for-your.html在我的viewmodel中实现异步方式.

这是我的viewmodel代码:

public class MainWindowViewModel:WorkspaceViewModel,INotifyCollectionChanged
    {        

        MatchBLL matchBLL = new MatchBLL();
        EfesBetServiceReference.EfesBetClient proxy = new EfesBetClient();

        public ICommand DoSomethingCommand { get; set; }
        public MainWindowViewModel()
        {
            DoSomethingCommand = new AsyncDelegateCommand(
                () => Load(), null, null,
                (ex) => Debug.WriteLine(ex.Message));           
            _matchObsCollection = new ObservableCollection<EfesBet.DataContract.GetMatchDetailsDC>();                

        }       

        List<EfesBet.DataContract.GetMatchDetailsDC> matchList;
        ObservableCollection<EfesBet.DataContract.GetMatchDetailsDC> _matchObsCollection;

        public ObservableCollection<EfesBet.DataContract.GetMatchDetailsDC> MatchObsCollection
        {
            get { return _matchObsCollection; }
            set
            {
                _matchObsCollection = value;
                OnPropertyChanged("MatchObsCollection");
            }
        }        
        // …
Run Code Online (Sandbox Code Playgroud)

c# silverlight wpf xaml mvvm

129
推荐指数
5
解决办法
8万
查看次数

如何避免用户帐户控制或在Win7中运行Windows应用程序始终处于管理模式

在我的应用程序启动时,在WinForms应用程序中,出现"用户帐户控制"对话框(仅在Windows7中).

任何人都可以建议我如何以编程方式避免这种情况 - 这是我的应用程序应该始终在管理模式下启动,还是有任何选项可以阻止此对话框的到来?

我正在开发C#,VS2008.

.net c# visual-studio-2008 visual-studio winforms

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

如何在MVVM中实现INotifyCollectionChanged,以进行NotifyCollectionChangedAction的重置,添加,删除,移动,替换

我的ViewModelBase类是:

public abstract class ViewModelBase:INotifyPropertyChanged, IDisposable, INotifyCollectionChanged
{
    #region Constructor

    protected ViewModelBase()
    {
    }

    #endregion // Constructor
    #region DisplayName

    /// <summary>
    /// Returns the user-friendly name of this object. 
    /// Child classes can set this property to a new value,
    /// or override it to determine the value on-demand.
    /// </summary>
    public virtual string DisplayName { get; protected set; }

    #endregion // DisplayName


    #region Debugging Aides

    /// <summary>
    /// Warns the developer if this object does not have
    /// a …
Run Code Online (Sandbox Code Playgroud)

silverlight wpf xaml observablecollection mvvm

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