Welcome to the Xceed Community | Help
Community Search  
More Search Options

DataTemplates and CellEditors change in 3.0? ActualContent property gone?

Sort Posts: Previous Next
  •  08-19-2008, 9:54 AM Post no. 14196

    DataTemplates and CellEditors change in 3.0? ActualContent property gone?

    Support

    I have a bunch of cell DataTemplates and CellEditors that I use in my code.

    Example:

    <DataTemplate x:Key="LengthCellTemplate">
            <TextBlock Text="{Binding Converter={StaticResource LengthConverter},
                                            RelativeSource={RelativeSource FindAncestor,
                                        AncestorType=xcdg:Cell},
                                        Path=ActualContent}"/>
        </DataTemplate>

    I just got used to using the ActualContent property for some scenarios back from 1.0 where Cell content wouldnt update in highly dynamic situations.

    Upon installing version 3.0 and running my program I see that all my cell data & editors are blank except for a few very simple ones that didnt use ActualContent (Luckily I didnt change them over or I might still be puzzled as to what happened) So I change the Above template to:


        <DataTemplate x:Key="LengthCellTemplate">
            <TextBlock Text="{Binding Converter={StaticResource LengthConverter}}"/>
        </DataTemplate>

     And now all the cells that use the LengthCellTemplate work upon simple visual tests

     My Questions are

    What effect will this have in my dynamic scenarios?

    Where did ActualContent go?

    Is it safe to change my DataTemplates like the example above and see the same results in my App?

    Thanks for your help

  •  08-19-2008, 10:20 AM Post no. 14200 in reply to 14196

    Re: DataTemplates and CellEditors change in 3.0? ActualContent property gone?

    Hi, 

    It is safe to change your DataTemplates. 

    The ActualContent property was an internal property and is gone for good.  It was given to some customers like yourself to work around the Cell .Content property always being equal to the value at the start of the edit process.

    It was one of our objective for version 3.0 to get rid of ActualContent and make the Cell's Content property "live" with the business object.

    Let me show you some scenarios so that everything is clear...

     

    Let's take for granted that your DataGridControl's UpdateSourceTrigger property (which drives when the cells Content is pushed in the business object) is set to DataGridUpdateSourceTrigger.RowEndingEdit.

    You enter edit on a row where a "Quantity" cell has a value of 20.

    You edit the value of the "Quantity" cell to 30 and do not leave edit...  the Cell's .Content is now equal to 30 and the business object's Quantity is still 20.

    You end edit on the row... now both the cell's content and the business object "Quantity" are 30.

     

    Now, if your DataGridControl's UpdateSourceTrigger was set to DataGridUpdateSourceTrigger.CellContentChanged, the cell's content is pushed into the business object as soon as it changes... let's have a look at the same scenario with this DataGridUpdateSourceTrigger....

    You enter edit on a row where a "Quantity" cell has a value of 20.

    You edit the value of the "Quantity" cell to 30... as you type '3', both the Cell's Content and the business object's 'Quantity' are now set to 3... you finish typing the new value with a 0... now both the Cell's Content and the business object's 'Quantity' are set to 30.



    This leaves us with the DataGridUpdatesourceTrigger.CellEndingEdit... As I am sure you understand by its name, this makes the DataGridControl push the cell's content to the business object when the cell ends the edit process even if the row is still being edited.

    You enter edit on a row where a "Quantity" cell has a value of 20.

    You edit the value of the "Quantity" cell to 30 and do not leave edit...  the Cell's .Content is now equal to 30 and the business object's Quantity is still 20.

    Without leaving edit on the row, you move to a different cell... now both the cell's content and the business object "Quantity" are 30.

     

    Regards,

     


    Pierre-Luc Ledoux
    Software Developer
    Xceed Software Inc.
  •  08-19-2008, 10:51 AM Post no. 14203 in reply to 14200

    Re: DataTemplates and CellEditors change in 3.0? ActualContent property gone?

    Thanks for the Reply

    Changing the above code for CellEditors didnt work

        <xcdg:CellEditor x:Key="LengthCellEditor">
            <xcdg:CellEditor.EditTemplate>
                <DataTemplate>
                    <xcd:AutoSelectTextBox  AutoSelectBehavior="OnFocus"
                                            Text="{Binding 
                                                    Converter={StaticResource LengthConverter}}"
                                            BorderBrush="Transparent"/>
                </DataTemplate>
            </xcdg:CellEditor.EditTemplate>
            <xcdg:CellEditor.ActivationGestures>
                <xcdg:TextInputActivationGesture/>
            </xcdg:CellEditor.ActivationGestures>
        </xcdg:CellEditor>
     

    Throws error

     

    So the original CellEditor

        <xcdg:CellEditor x:Key="LengthCellEditor">
            <xcdg:CellEditor.EditTemplate>
                <DataTemplate>
                    <xcd:AutoSelectTextBox  AutoSelectBehavior="OnFocus" Text="{Binding  RelativeSource={RelativeSource FindAncestor,
                                                    AncestorType=xcdg:Cell},
                                                    Path=ActualContent,
                                                    UpdateSourceTrigger=PropertyChanged,
                                                    Converter={StaticResource LengthConverter}}"
                                            BorderBrush="Transparent"/>
                </DataTemplate>
            </xcdg:CellEditor.EditTemplate>
            <xcdg:CellEditor.ActivationGestures>
                <xcdg:TextInputActivationGesture/>
            </xcdg:CellEditor.ActivationGestures>
        </xcdg:CellEditor>

    All I should do Is change ActualContent to Content?

    or are there other changes to optimize performance because I have seen a big slow down in 3.0 from 2.X in load times, cell changing and scrolling (In debug mode mind you, Also I just switched to vs2008sp1 and .NET 3.5sp1 but you and .NET claim big speed improvements)

  •  08-19-2008, 11:09 AM Post no. 14205 in reply to 14203

    Re: DataTemplates and CellEditors change in 3.0? ActualContent property gone?

    Hi Tommy,

       As for previous versions, usage of the CellEditorBindingExtension is required to bind the Editor to the Cell`s content.

       Your Binding did mimick the CellEditorBinding that was created for previous versions, but the CellEditorBinding had to be modified to take into considerations the recent changes in the architecture.

       <xcd:AutoSelectTextBox  AutoSelectBehavior="OnFocus" Text="{xcdg:CellEditorBinding
                                             Converter={StaticResource LengthConverter}}"
                                             BorderBrush="Transparent"/>

    As for the problem you are experiencing with the performance, we're gonna need more details concerning your setup as our benchmarks showed a 3x improvement in load time and up to 5x improvement on scrolling operations ( With or Without the installation of the .NET 3.5 SP1 ).

    Marc Laroche
    Software Developer
    Xceed Software Inc.


    I don’t suffer from insanity, I enjoy every minute of it. - Unknown
  •  08-19-2008, 11:12 AM Post no. 14206 in reply to 14205

    Re: DataTemplates and CellEditors change in 3.0? ActualContent property gone?

    Thankyou much

    I will research the speed issue It could just be overhead from catching exceptions

     

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.