Esempio n. 1
0
        private void registerBinderFor <T>(DevExpress.XtraGrid.Views.Base.BaseView view, Func <GridViewBinder <T>, OptimizedParametersBinder> initBinding) where T : class
        {
            var dataSource = view.DataSource as IEnumerable <T>;

            if (!_optimizedParametersBinderCache.Contains(view))
            {
                var gridView = view.DowncastTo <GridView>();
                var binder   = new GridViewBinder <T>(gridView)
                {
                    BindingMode = BindingMode.OneWay
                };
                _optimizedParametersBinderCache.Add(gridView, initBinding(binder));
            }

            var gridViewBinder = _optimizedParametersBinderCache[view].GridViewBinder.DowncastTo <GridViewBinder <T> >();

            gridViewBinder.BindToSource(dataSource);
        }
Esempio n. 2
0
        private void registerBinderFor <T>(BaseView view, Action <GridViewBinder <T> > initBinding) where T : class
        {
            var dataSource = view.DataSource as IEnumerable <T>;

            if (!_cache.Contains(view))
            {
                var gridView = view.DowncastTo <GridView>();
                var binder   = new GridViewBinder <T>(gridView)
                {
                    BindingMode = BindingMode.OneWay
                };
                initBinding(binder);
                _cache.Add(gridView, binder);
            }

            var gridViewBinder = _cache[view].DowncastTo <GridViewBinder <T> >();

            gridViewBinder.BindToSource(dataSource);
        }