AnimationSelector Expand/Collapse

2 posts, 1 answers
  1. Steve
    Steve avatar
    50 posts
    Member since:
    Apr 2013

    Posted 07 May 2013 Link to this post

    Hello,

    I'm trying AnimationSelector Expand/Collapse not work in WPF in Silverlight not any problem. Thanks.

    <Style x:Key="RadComboBoxStyle" TargetType="telerik:RadComboBox">
        <Setter Property="Template" Value="{StaticResource NonEditableComboBox}"/>
        <Setter Property="EditableTemplate" Value="{StaticResource EditableComboBox}"/>
        <Setter Property="NonEditableTemplate" Value="{StaticResource NonEditableComboBox}"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="MinHeight" Value="22"/>
        <Setter Property="Padding" Value="4,0,20,0"/>
        <Setter Property="Background" Value="{StaticResource MarkerBrush}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="UseLayoutRounding" Value="True"/>
        <Setter Property="telerik:AnimationManager.AnimationSelector">
            <Setter.Value>
                <telerik:AnimationSelector>
                    <telerik:AnimationGroup AnimationName="Expand">
                        <telerik:SlideAnimation Direction="In" SlideMode="Top" TargetElementName="PopupRoot"/>
                    </telerik:AnimationGroup>
                    <telerik:AnimationGroup AnimationName="Collapse">
                        <telerik:SlideAnimation Direction="Out" SlideMode="Top" TargetElementName="PopupRoot"/>
                    </telerik:AnimationGroup>
                </telerik:AnimationSelector>
            </Setter.Value>
        </Setter>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontSize" Value="12"/>       
        <Setter Property="BorderBrush" Value="{StaticResource MainBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource BasicBrush}"/>
        <Setter Property="ItemContainerStyle" Value="{StaticResource RadComboBoxItemStyle}"/>
    </Style>
  2. Answer
    Masha
    Admin
    Masha avatar
    355 posts

    Posted 09 May 2013 Link to this post

    Hello Steve,

    Unfortunately the desired approach cannot be achieved in wpf applications.
    AnimationManager.AnimationSelector property is supported for Silverlight only.

    I can suggest you to create CustomComboBox something like this:
    public class CustomComboBox : RadComboBox
    {
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
     
            var popup = GetTemplateChild("PART_Popup") as System.Windows.Controls.Primitives.Popup;
            popup.Opened += popup_Opened;
        }
     
        void popup_Opened(object sender, EventArgs e)
        {
            var popup = GetTemplateChild("PART_Popup") as System.Windows.Controls.Primitives.Popup;
            popup.PopupAnimation = PopupAnimation.Fade;
        }
    }

    I hope this information will be helpful.

    All the best,
    Masha
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top