0

Bug or feature - BillboardTextGroupVisual3D doesn't accept ObservableCollection<BillboardTextItem>

Anonymous 5 years ago 0
This discussion was imported from CodePlex

mesta wrote at 2013-11-19 12:54:

In the latest versions, there was a change to Items property of BillboardTextGroupVisual3D, from IList to List, so now i can't bind the ObservableCollections anymore.

I had a project that with the latest version stopped working because of this modification, so i had to take the source and recompile them with IList.
Maybe you should consider to return to IList as Items property for the next versions ?
/// <summary>
        /// Identifies the <see cref="Items"/> dependency property.
        /// </summary>
        public static readonly DependencyProperty ItemsProperty = DependencyProperty.Register(
            "Items",
            typeof(List<BillboardTextItem>),
            typeof(BillboardTextGroupVisual3D),
            new UIPropertyMetadata(null, VisualChanged));
 /// <summary>
        /// Gets or sets the items.
        /// </summary>
        /// <value>The items.</value>
        public List<BillboardTextItem> Items
        {
            get
            {
                return (List<BillboardTextItem>)this.GetValue(ItemsProperty);
            }

            set
            {
                this.SetValue(ItemsProperty, value);
            }
        }

objo wrote at 2013-11-19 13:31:

thanks, that was a mistake. Fixed now. New version on Nuget will be available later today.

mesta wrote at 2013-11-19 13:45:

I checked the commit and there is also the UIPropertyMetadata callback that has to be changed; this is the old one that was working.
public static readonly DependencyProperty ItemsProperty = DependencyProperty.Register("Items", typeof(IList<BillboardTextItem>), typeof(BillboardTextGroupVisual3D), new UIPropertyMetadata(null, new PropertyChangedCallback(BillboardTextGroupVisual3D.VisualChanged)));
Thank you, your library is awesome !

objo wrote at 2013-11-19 18:45:

you mean the new PropertyChangedCallback(? I think this is a redundant delegate constructor. Tested with NET 4.0 and 4.5.

chadsixt wrote at 2014-04-17 18:24:

Hey Guys,

I am using the BillboardTextGroupVisual3D, defined in xaml. I have the Items bound to an ObservableCollection<BillboardTextItem>, so when I add a BillboardTextItem to the Group all is well. When I attempt to detect the user clicking on one of the BillboardTextItems, I only see the BillboardTextGroupVisual3D, and I am unable to detect which actual item it is, so I can remove it from the group. I could come up with a algorithm to find the closest Item in the group based on the HitPoint? Is there something that can help already there somewhere...?? I,d rather not have to add BillboardTextVisuals for ever Item I want to display in the viewport...

Thanks again, Love the project
Chad

objo wrote at 2014-04-29 10:20:

This is an interesting feature. It should be possible to add this to BillboardTextGroupVisual3D.
I added https://helixtoolkit.codeplex.com/workitem/10038