Home Forums WPF controls Xceed DataGrid for WPF DataContext in CellEditor Template

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23720 |

    Hi,

    Will the DataContext of the grid be available in the Element which I use in my CellEditor?

    I am using something like this:

    <xcdg:CellEditor x:Key=”MyCellEditor”>
    <xcdg:CellEditor.EditTemplate>
    <DataTemplate>
    <sl:MyCombo
    SelectedValue=”{xcdg:CellEditorBinding}”/>
    </DataTemplate>
    </xcdg:CellEditor.EditTemplate>
    </xcdg:CellEditor>

    Thanks
    Silas

    Imported from legacy forums. Posted by Ralf (had 873 views)

    User (Old forums)
    Member
    Post count: 23064

    I understand, that values are written back to the underlying object with CellEditorBinding. However what I need is to get access to other properties of that object as well because the view of the MyCombo depends on that properties. Is there a way to do that? I did some debuging and it seems that currently it can not be done through DataContext 🙁

    cheers
    Silas

    Imported from legacy forums. Posted by Ralf (had 486 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi,
    Can you please tell me how can i add combo box to xceed grid columns?

    Thanks

    KK

    Imported from legacy forums. Posted by kk (had 519 views)

    User (Old forums)
    Member
    Post count: 23064

    Please start your own Thread, otherwise I never get help for my problem in here. However, try something like this:

    <xcdg:Column
    FieldName=”Field”
    Title=”Title”
    DisplayMemberBinding=”{Binding Path=Field, Mode=TwoWay}”>
    <xcdg:CellEditor>
    <xcdg:CellEditor.EditTemplate>
    <DataTemplate>
    <xcdg:NavigableComboBox/>
    </DataTemplate>
    </xcdg:CellEditor.EditTemplate>
    </xcdg:CellEditor>
    <xcdg:Column>

    Hth
    Silas

    Imported from legacy forums. Posted by Ralf (had 483 views)

    User (Old forums)
    Member
    Post count: 23064

    thanks. I have started my on thread can u please help me there. My thread name is adding combobox in xceed datagrid .This code is not working .

    i need to add any reference for this.
    <xcdg:NavigableComboBox/>

    thanks
    kk

    Imported from legacy forums. Posted by kk (had 861 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Silas,

    If you want to ensure to have access to the data item from the CellEditor, you can bind to the DataCell’s DataContext (instead of the DataTemplate’s DataContext).

    Here is a quick example how how to achieve such binding:

    <objectX propertyY=”{Binding RelativeSource={RelativeSource AncestoryType={x:Type xcdg:DataCell}}, Path=DataContext}” />

    That way, propertyY will hold the original, unmodified data item.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 232 views)

    Xceed Support
    Member
    Post count: 5658

    kk, I advise searching the forum (see the “readme” post for details on how to search using the “bugged” search features)…

    There is already a fair amount of posts in the history from people that wanted to achieve the same result.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 260 views)

    User (Old forums)
    Member
    Post count: 23064

    Seems to work, thanks Marcus!

    Imported from legacy forums. Posted by Ralf (had 5921 views)

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.