示例#1
0
        private void AssociatedObject_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.Tab:
                TargetPopup.IsOpen = false;
                break;

            case Key.Down:
                if (TargetListBox.Items.Count > 0)
                {
                    TargetListBox.Focus();
                    var listBoxItemToFocus =
                        (ListBoxItem)TargetListBox
                        .ItemContainerGenerator
                        .ContainerFromItem(TargetListBox.Items[0]);
                    listBoxItemToFocus.Focus();
                }
                e.Handled = true;
                break;

            default:

                break;
            }
        }
示例#2
0
        private void TargetListBox_DrawItem(object sender, DrawItemEventArgs e)
        {
            var listItem = TargetListBox.Items[e.Index];

            SolidBrush textBrush;

            if (listItem == SelectedBone)
            {
                e.Graphics.FillRectangle(SystemBrushes.Control, e.Bounds);
                textBrush = new SolidBrush(Color.DarkGray);
                //textBrush = new SolidBrush(e.ForeColor);
            }
            else
            {
                e.DrawBackground();
                textBrush = new SolidBrush(e.ForeColor);
            }

            e.Graphics.DrawString(TargetListBox.GetItemText(listItem),
                                  e.Font, textBrush, e.Bounds);

            textBrush.Dispose();
        }
示例#3
0
 private void SourceCombo_SelectedIndexChanged(object sender, EventArgs e)
 {
     //var oldBone = _SelectedBone;
     //_SelectedBone = SourceCombo.SelectedItem as PartBone;
     TargetListBox.Invalidate();
 }