Наследование: System.Windows.Markup.MarkupExtension
Пример #1
0
        private static void InititializeRoute(FrameworkElement fe, string route, DependencyProperty property)
        {
            PropertyRoute parentContext = GetPropertyRoute(fe.Parent ?? fe);

            if (parentContext == null)
            {
                throw new InvalidOperationException("Route attached property can not be set with null PropertyRoute: '{0}'".FormatWith(route));
            }

            var context = ContinueRouteExtension.Continue(parentContext, route);

            if (property == Common.RouteProperty)
            {
                SetPropertyRoute(fe, context);

                foreach (var task in RouteTask.GetInvocationListTyped())
                {
                    task(fe, route, context);
                }
            }
            else
            {
                foreach (var task in LabelOnlyRouteTask.GetInvocationListTyped())
                {
                    task(fe, route, context);
                }
            }
        }
Пример #2
0
        static void DataGrid_Initialized(object sender, EventArgs e)
        {
            DataGrid      grid          = (DataGrid)sender;
            PropertyRoute parentContext = GetPropertyRoute(grid).Add("Item");

            SetPropertyRoute(grid, parentContext);

            foreach (DataGridColumn column in grid.Columns)
            {
                if (column.IsSet(Common.RouteProperty))
                {
                    string        route   = (string)column.GetValue(Common.RouteProperty);
                    PropertyRoute context = ContinueRouteExtension.Continue(parentContext, route);

                    SetPropertyRoute(column, context);

                    foreach (var task in DataGridColumnRouteTask.GetInvocationListTyped())
                    {
                        task(column, route, context);
                    }
                }
                else
                {
                    if (column.IsSet(Common.LabelOnlyRouteProperty))
                    {
                        string        route   = (string)column.GetValue(Common.LabelOnlyRouteProperty);
                        PropertyRoute context = ContinueRouteExtension.Continue(parentContext, route);

                        foreach (var task in DataGridColumnLabelOnlyRouteTask.GetInvocationListTyped())
                        {
                            task(column, route, context);
                        }
                    }
                }
            }
        }
Пример #3
0
        static void ListView_Initialized(object sender, EventArgs e)
        {
            ListView      lv            = (ListView)sender;
            PropertyRoute parentContext = GetPropertyRoute(lv).Add("Item");

            SetPropertyRoute(lv, parentContext);

            foreach (GridViewColumn column in ((GridView)lv.View).Columns)
            {
                if (column.IsSet(Common.RouteProperty))
                {
                    string        route   = (string)column.GetValue(Common.RouteProperty);
                    PropertyRoute context = ContinueRouteExtension.Continue(parentContext, route);

                    SetPropertyRoute(column, context);

                    foreach (var task in GridViewColumnRouteTask.GetInvocationListTyped())
                    {
                        task(column, route, context);
                    }
                }
                else
                {
                    if (column.IsSet(Common.LabelOnlyRouteProperty))
                    {
                        string        route   = (string)column.GetValue(Common.LabelOnlyRouteProperty);
                        PropertyRoute context = ContinueRouteExtension.Continue(parentContext, route);

                        foreach (var task in GridViewColumnLabelOnlyRouteTask.GetInvocationListTyped())
                        {
                            task(column, route, context);
                        }
                    }
                }
            }
        }