protected override DataContext CreateDataContext()
        {
            // Create and register the base DialogContext
            DataContext context = base.CreateDataContext();

            // Set up the collections we need for the various
            // combo boxes on the form.
            DomainDAO appDao = DomainFactory.GetDAO("Application");

            List<Domain> applications = appDao.Get();

            context.AddObject("Applications", applications);

            DomainDAO propDao = DomainFactory.GetDAO("PropertyDefinition");

            List<Domain> properties = propDao.Get();

            context.AddObject("PropertyDefinitions", properties);

            DomainDAO dao = DomainFactory.GetDAO("Form");

            List<Domain> valueList = dao.Get();

            context.AddObject("Forms", valueList);

            // Create a context for use by the Effective Date Editor
            SetContext(new DataContext("EffectiveDateCtx"));

            DataContext vcContext = new DataContext("ValueCriteriaCtx");
            // Create a context for use by the Value Criteria Editor
            SetContext(vcContext);

            // Register interest in when the contexts change...
            context.ContextChanged += ContextChangeHandler;
            vcContext.ContextChanged += ContextChangeHandler;

            return context;
        }
        /// <summary>
        /// Recursively searches the widget hierarchy for a data context container
        /// that has the required data context.
        /// </summary>
        /// <param name="widget">
        /// The widget on which to search for the data context.
        /// </param>
        /// <returns>
        /// A reference to the data context if found. Otherwise, return <c>null</c>.
        /// </returns>
        private DataContext GetContext(Widget widget)
        {
            DataContext context = null;

            if (widget != null)
            {
                if (widget is ContextContainer)
                {
                    context = ((ContextContainer) widget).GetContext(contextName);
                }
                else
                {
                    context = GetContext(widget.Parent);
                }
            }

            return context;
        }
 public void SetContext(DataContext context)
 {
     Data[context.Name] = context;
 }
        public void ConnectControl()
        {
            context = Context;

            if (context != null)
            {
                context.ContextChanged += ContextChangeHandler;
            }
        }
        /// <summary>
        /// An overrideable method that creates a data context and registers it with
        /// the container.
        /// </summary>
        /// <remarks>
        /// The name of the default data context is <c>DialogContext</c>.
        /// </remarks>
        /// <returns>
        /// Reference to the newly created data context.
        /// </returns>
        protected virtual DataContext CreateDataContext()
        {
            DataContext context = new DataContext("DialogContext");

            SetContext(context);

            return context;
        }