Custom GridViewDataColumn

2 posts, 0 answers
  1. dttanh
    dttanh avatar
    13 posts
    Member since:
    Aug 2012

    Posted 11 Nov 2011 Link to this post

    Hello,

    I created a custom GridViewDataColumn like this:
    public class EmpGridViewActionColumn : EMPGridViewDataColumn
    {
        public static readonly DependencyProperty ActionsProperty =
            DependencyProperty.Register(
            "Actions",
            typeof(IList<ActionData>),
            typeof(EMPGridView),
            new PropertyMetadata(null, new PropertyChangedCallback(ActionsValueChange))
         );
     
        public IList<ActionData> Actions
        {
            get { return (IList<ActionData>)GetValue(ActionsProperty); }
            set { SetValue(ActionsProperty, value); }
        }
     
        private static void ActionsValueChange(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue != null)
            {
                ((EmpGridViewActionColumn)source).Actions = (IList<ActionData>)e.NewValue;
                ((EmpGridViewActionColumn)source).ApplyEmpGridViewActionColumnTemplate();
            }
        }
    }

    And in xaml:
       
    <myControls:EmpGridViewActionColumn Header="Type" Width="120">
                    <myControls:EmpGridViewActionColumn.Actions>
                        <myControls:EMPActionDataContract Name="Test"/>
                    </myControls:EmpGridViewActionColumn.Actions>
                </myControls:EmpGridViewActionColumn>
    At run time: I encounter error at line:
    <myControls:EMPActionDataContract Name="Test"/>

    Does anyone have any idea or solution?
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 14 Nov 2011 Link to this post

    Hello Tuan Anh,

    Can you please clarify how is that problem specifically related to Telerik controls? If you do the same thing on another object does your XAML work?

    Best wishes,
    Ross
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top