public void Choose_Subtype(object sender, RoutedEventArgs e) { Button b = sender as Button; QuantitativeRelationshipNode q = b.DataContext as QuantitativeRelationshipNode; MenuFlyout menu = new MenuFlyout(); int index = (int)q.Type; string[] r = q.SubtypeNames[index]; for (int i = 0; i < r.Length; i++) { MenuFlyoutItem item = new MenuFlyoutItem() { Text = r[i], Tag = i }; item.Click += delegate(object s, RoutedEventArgs args) { int inp = (int)((MenuFlyoutItem)s).Tag; q.SubtypeSource = inp; Exp.Save(); }; menu.Items.Add(item); } menu.ShowAt(b); }
public void Quant_Type_Click(object sender, RoutedEventArgs e) { QuantitativeRelationshipNode.QuantType[] options = { QuantitativeRelationshipNode.QuantType.Correlation, QuantitativeRelationshipNode.QuantType.Function, QuantitativeRelationshipNode.QuantType.Statistical }; MenuFlyoutItem sel = (MenuFlyoutItem)sender; QuantitativeRelationshipNode node = sel.DataContext as QuantitativeRelationshipNode; int index = Convert.ToInt32((string)sel.Tag); node.TypeSource = options[index]; Exp.Save(); }