예제 #1
0
        private void SetDynamicallyCreatedTextboxValue(object sender, SelectionChangedEventArgs e)
        {
            ComboBox     senderCb          = (ComboBox)sender;
            int          cbNum             = int.Parse(senderCb.Name.Split('_')[4]);
            ComboBoxItem selectedFirstItem = (ComboBoxItem)senderCb.SelectedItem;
            string       ingridientValue   = (string)selectedFirstItem.Content;
            Ingridient   ingridient        = Ingridients.FirstOrDefault(i => i.Name == ingridientValue);

            Label lbl = new Label();

            foreach (var grid in Grid_New_Recipe_Ingridients.Children)
            {
                if ((grid as Grid).Name.Contains(cbNum.ToString()))
                {
                    foreach (var child in (grid as Grid).Children)
                    {
                        if (child.GetType() == typeof(Label))
                        {
                            if ((child as Label).Name.Contains(cbNum.ToString()))
                            {
                                lbl = child as Label;
                                break;
                            }
                        }
                    }
                }
            }

            lbl.Content = "מתוך " + MeasurmentUnitHeb.GetUnitHebrewValue(ingridient.MeasurmentUnit);
        }
예제 #2
0
        private void Cb_New_Recipe_Ing_1_Selected(object sender, RoutedEventArgs e)
        {
            ComboBox     senderCb          = (ComboBox)sender;
            ComboBoxItem selectedFirstItem = (ComboBoxItem)senderCb.SelectedItem;
            string       ingridientValue   = (string)selectedFirstItem.Content;
            Ingridient   ingridient        = Ingridients.FirstOrDefault(i => i.Name == ingridientValue);

            Lbl_New_Recipe_Ingridient_1_Amount_Name.Content = "מתוך " + MeasurmentUnitHeb.GetUnitHebrewValue(ingridient.MeasurmentUnit);
        }