This is a migrated thread and some comments may be shown as answers.

Custom GridViewDataColumn

1 Answer 69 Views
GridView
This is a migrated thread and some comments may be shown as answers.
dttanh
Top achievements
Rank 1
dttanh asked on 12 Nov 2011, 05:03 AM
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?

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 14 Nov 2011, 09:49 AM
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 >>

Tags
GridView
Asked by
dttanh
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or