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

Get Parent of selfwritten GridViewColumn

0 Answers 106 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 29 Nov 2012, 07:36 PM
Hi There,

first i want to explain to you what i want, than how i solved it and finally what my problem is.

I was looking for a SelectionChangedEvent on a GridViewComboBoxColumn because based on the selection i have to calculate another property of my "RowItem".
e.g. A user change the value in my first column ( a GridViewComboBoxColumn ), so the value in column no 3 has to be calculated.

Because i didn't find an event, which i can use.

I created my own column, it work mostly:

public class ComboBoxColumn : GridViewBoundColumnBase
  {
   ######################shorted##############################
 
    public event SelectionChangedEventHandler SelectionChanged;
 
    private void OnSelectionChanged( object sender, SelectionChangedEventArgs e )
    {
      var myEvent = this.SelectionChanged;
      if( myEvent != null )
      {
        myEvent( this,
                 e );
      }
    }
 
    private void ComboBoxSelectionChanged( object sender, SelectionChangedEventArgs e )
    {
      this.OnSelectionChanged( sender,e );
    }
     
     ######################shorted##############################
 
    public override FrameworkElement CreateCellEditElement( GridViewCell cell,
                                                            object dataItem )
    {
      this.BindingTarget = RadComboBox.SelectedValueProperty;
      var comboBox = new RadComboBox
        {
          ItemsSource = this.ItemsSource,
          DisplayMemberPath = this.DisplayMemberPath,
          SelectedValuePath = this.SelectedValuePath
        };
      comboBox.SelectionChanged += this.ComboBoxSelectionChanged;
      comboBox.SetBinding( this.BindingTarget,
                           this.CreateValueBinding( ) );
      return comboBox;
    }

My problem is now that i am unable to get the row item in my gridview to set the property for the third column.
Can somebody helps me by this issue? Or is it the wrong why to solve this problem?

Many thanks in advance for your cooperation


No answers yet. Maybe you can help?

Tags
GridView
Asked by
Mark
Top achievements
Rank 1
Share this question
or