Ejemplo n.º 1
0
        private void UpdateSelectedItem()
        {
            var numberOfItems = this.ParameterDisplay.Items.Count;

            for (int i = 0; i < numberOfItems; i++)
            {
                var element     = this.ParameterDisplay.ItemContainerGenerator.ContainerFromIndex(i) as FrameworkElement;
                var relativePos = Mouse.GetPosition(element);
                if (element.InputHitTest(relativePos) != null)
                {
                    this.SelectedItem = (this.ParameterDisplay.ItemContainerGenerator.ContainerFromIndex(i) as FrameworkElement).DataContext as ModelParameterProxy;
                    return;
                }
            }
            var frameworkElement = this.ParameterDisplay.ItemContainerGenerator.ContainerFromIndex(numberOfItems) as FrameworkElement;

            if (frameworkElement != null)
            {
                this.SelectedItem = frameworkElement.DataContext as ModelParameterProxy;
            }
        }
Ejemplo n.º 2
0
 private void UpdateSelectedItem()
 {
     var numberOfItems = this.ParameterDisplay.Items.Count;
     for ( int i = 0; i < numberOfItems; i++ )
     {
         var element = this.ParameterDisplay.ItemContainerGenerator.ContainerFromIndex( i ) as FrameworkElement;
         var relativePos = Mouse.GetPosition( element );
         if ( element.InputHitTest( relativePos ) != null )
         {
             this.SelectedItem = ( this.ParameterDisplay.ItemContainerGenerator.ContainerFromIndex( i ) as FrameworkElement ).DataContext as ModelParameterProxy;
             return;
         }
     }
     var frameworkElement = this.ParameterDisplay.ItemContainerGenerator.ContainerFromIndex( numberOfItems ) as FrameworkElement;
     if ( frameworkElement != null )
     {
         this.SelectedItem = frameworkElement.DataContext as ModelParameterProxy;
     }
 }