internal static void FixupDataContext(IBindableContentElement element)
        {
            var contentElement = element as FrameworkContentElement;

            if (contentElement != null)
            {
                Binding b = new Binding(FrameworkContentElement.DataContextProperty.Name);
                b.RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(FrameworkElement), 1);
                contentElement.SetBinding(FrameworkContentElement.DataContextProperty, b);
            }
            else
            {
                throw new ArgumentException("The given element must be a FrameworkContentElement", "element");
            }
        }
Ejemplo n.º 2
0
        internal static void FixupDataContext(IBindableContentElement element)
        {
            var contentElement = element as FrameworkContentElement;

            if (contentElement != null)
            {
                Binding b = new Binding(FrameworkContentElement.DataContextProperty.Name);
                b.RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(FrameworkElement), 1);
                contentElement.SetBinding(FrameworkContentElement.DataContextProperty, b);
            }
            else
            {
                throw new ArgumentException("The given element must be a FrameworkContentElement", "element");
            }
        }