Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

RC0 - DataGridColumn.Header property removed - not a go... RSS

0 replies

Last post Sep 29, 2008 06:18 PM by Bartlomiej

(0)
  • Bartlomiej

    Bartlomiej

    Member

    68 Points

    45 Posts

    RC0 - DataGridColumn.Header property removed - not a good idea!

    Sep 29, 2008 06:18 PM | LINK

    ... from the breaking changes list for DataGrid: DataGridColumn.Header no longer supports visuals. Explaination: Visuals cannot be duplicated so they cannot be used for the Header property due to column reordering. Use HeaderStyle instead:
    ...

    This is NOT A GOOD IDEA! Now in RC0 there is no way to set up an instance of the Custom DataGrid Column Header as a Header of the DataGridTemplateColumn. The problem is that HeaderStyle generates its own instance of the Custom ColumnHeader and there is no way to update its properties after setting the style. There is no way to set up those properties before setting the HeaderStyle, too. This kind of code, which worked in Beta2 (was clear and simple), now gives no effect:

    DataGridTextColumn _dgtc = new DataGridTextColumn();
    myListHeader lh = new myListHeader();
    int parameter = 0;
    
    lh.mySortHyperlinkButton.Click += new RoutedEventHandler(mySortHyperlinkButton_Click);
    lh.myFilterTextBox.LostFocus += new RoutedEventHandler(myFilterTextBox_LostFocus);
    lh.SizeChanged += (s, e)  =>
                {
                    parameter  += 1; // for example
                };
    
    // _dgtc.Header = lh;  // for Beta2
    _dgtc.HeaderStyle = Application.Current.Resources["ColumnHeaderStyle"] as Style;

    B.