public override ControlStyleBuilderInfoList GetThemeDesignedControls(Control previewSurface)
        {
            RadCarousel carousel = new RadCarousel();

            carousel.Size = new Size(320, 240);

            carousel.Text = "RadCarousel";

            RadCarousel carouselStructure = new RadCarousel();

            carouselStructure.AutoSize = true;

            carouselStructure.Text = "RadCarousel";
            carouselStructure.Size = new Size(320, 240);

            ControlStyleBuilderInfo designed = new ControlStyleBuilderInfo(carousel, carouselStructure.RootElement);

            designed.MainElementClassName = typeof(RadCarouselElement).FullName;

            ControlStyleBuilderInfoList res = new ControlStyleBuilderInfoList();

            res.Add(designed);

            return(res);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The GetSelectedIndex.
        /// </summary>
        /// <param name="d">The d<see cref="DependencyObject"/>.</param>
        /// <returns>The <see cref="int"/>.</returns>
        public static int GetSelectedIndex(DependencyObject d)
        {
            RadCarousel dpo  = (RadCarousel)d;
            ICard       card = (ICard)dpo.CurrentItem;
            var         coll = dpo.Items;

            return(coll.IndexOf(card));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The SelectedIndexAttachedChanged.
        /// </summary>
        /// <param name="d">The d<see cref="DependencyObject"/>.</param>
        /// <param name="e">The e<see cref="DependencyPropertyChangedEventArgs"/>.</param>
        private static void SelectedIndexAttachedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            int newLocation = (int)e.NewValue;
            int oldLocation = (int)e.OldValue;

            if (!d.Equals(null))
            {
                RadCarousel radCarousel = (RadCarousel)d;
                Application.Current.Dispatcher.BeginInvoke(
                    new Action(() =>
                {
                    radCarousel !.CurrentItem  = radCarousel.Items[newLocation];
                    radCarousel !.SelectedItem = radCarousel !.CurrentItem;
                }), DispatcherPriority.Render);
                if (newLocation == 0)
                {
                    Application.Current.Dispatcher.BeginInvoke(new Action(() => { radCarousel !.BringDataItemIntoView(radCarousel.CurrentItem); }), DispatcherPriority.Render);
                }
            }
        }