Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
815
Animation on grid and other questions
posted

Hello,

So far i have been reading a lot about WPF in a short time and can't solve some problems. Hope you guys cand clear the air for me.

1) I'm looking to implement some animations for the xamdatagrid rows. What i need is to create something like what the carousel does, expand the size of a row when i drag the mouse over it (i need a scaling effect on my datarow). Is that possible? And if yes, can that be done to a cell or any sort of control/component ? How?

 2) Can a datagrid cell contain a panel or any sort of container that holds another custom usercontrol, like the carouselPanel? (i know it may seem stupid...but it may work, in classic infra with a little creation filter rewriting you could do just about anything :D )

3) If there is an accessible function just like CreationFilter, is there any way to get some sort of support for rewriting it, so that we may modify WPF controls?

4) I see here valuelists are not so popular, do you recomand not using them?

Thank you, I hope someone can answer nr 1 and 2 since they are a more pressing matter.

Parents
No Data
Reply
  • 69686
    Verified Answer
    posted

    Hello,

    1. Regarding the Scaling Effects. If you want to scale a records, you can create a style for the DataRecordPresenter and scale it. Something like this:

    <Style  TargetType="{x:Type igDP:DataRecordPresenter}">
    <Setter Property="RenderTransformOrigin" Value="0,0.5"/>
    <Setter.Value>
    <ScaleTransform ScaleX="1" ScaleY="1"/>
    </Setter.Value>
    </Setter>
    <EventSetter Event="MouseEnter" Handler="dp_MouseEnter"/>
    <EventSetter Event="MouseLeave" Handler="dp_MouseLeave"/>
    </Style>

     

    void dp_MouseLeave(object sender, MouseEventArgs e)

            {

                if (sender != null)

                {

                    DataRecordPresenter dp = sender as DataRecordPresenter;

                    dp.RenderTransform = new ScaleTransform(1, 1);

                }

            }

            void dp_MouseEnter(object sender, MouseEventArgs e)

            {

                if (sender != null)

                {

                    DataRecordPresenter dp = sender as DataRecordPresenter;

                    dp.RenderTransform = new ScaleTransform(1.2, 1.2);

                }

            }

    You can do it on any element. If you want on a Cell, the target type should be CellValuePresenter. You can do the same for the other parts of the XamDataGrid - LabelPresenter, RecordSelector, ExpansionIndicator,etc.

    Moreover, you can take a look at the default styles for our controls/parts in the DefaultStyles directory in the Infragistics folder on your computer. This also concerns your second question - yes, the CellValuePresenter can hold any element as its content property is of type object. All you have to do is retemplate it using these default styles as a basis for your own. You might find useful looking at this post by Andrew Smith about hosting elements in the XamDataGrid.

    In the case of hosting complex elements in a Cell, you should be aware of the nesting element depth limitation of the WPF framework (I believe around 255).

    I am not quite sure what you mean by CreationFilter, so please give us more information about that.

    4) We recommend using collections that support two-way binding like ObservableCollection<T> or BindingList<T> which are most commonly used with the XamDataGrid. Of course, you can use any collection,list that you want.

    Hope this helps

Children