Beispiel #1
0
        private void btnDeletePercent_Click(object sender, RoutedEventArgs e)
        {
            RadButton btn                 = (RadButton)sender;
            var       groupbox            = btn.ParentOfType <System.Windows.Controls.GroupBox>();
            var       lbxMaterielPercents = View.Extension.UIHelper.GetVisualChild <ListBox>(groupbox, "lbxMaterielPercents");

            if (lbxMaterielPercents.SelectedItem != null)
            {
                MaterielInfo info = btn.DataContext as MaterielInfo;
                info.MaterielPercents.Remove((MaterielPercent)lbxMaterielPercents.SelectedItem);
            }
        }
Beispiel #2
0
        private void btnAddPercent_Click(object sender, RoutedEventArgs e)
        {
            RadButton    btn                 = (RadButton)sender;
            var          groupbox            = btn.ParentOfType <System.Windows.Controls.GroupBox>();
            var          lbxMaterielPercents = View.Extension.UIHelper.GetVisualChild <ListBox>(groupbox, "lbxMaterielPercents");
            MaterielInfo info                = btn.DataContext as MaterielInfo;

            if (lbxMaterielPercents.SelectedIndex != -1)
            {
                info.MaterielPercents.Insert(lbxMaterielPercents.SelectedIndex + 1, new MaterielPercent());
            }
            else
            {
                info.MaterielPercents.Add(new MaterielPercent());
            }
        }