static void OnSelectedIndexChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            BeamPortStack me = sender as BeamPortStack;

            if (me != null)
            {
                me.SetSelectedItemMask();
            }
        }
        static void OnBeamPortsChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            BeamPortStack me = sender as BeamPortStack;

            if (me != null)
            {
                BeamPortCollection old = e.OldValue as BeamPortCollection;
                if (old != null)
                {
                    old.CollectionChanged -= new System.Collections.Specialized.NotifyCollectionChangedEventHandler(me.BeamPorts_CollectionChanged);
                }
                if (me.BeamPorts != null)
                {
                    me.BeamPorts.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(me.BeamPorts_CollectionChanged);
                    // me.SelectedIndex = me.BeamPorts.Count;
                }
            }
        }