private void Window_Loaded(object sender, RoutedEventArgs e) { txtName.Text = rule.Name; switch ((RuleFile.TypeFileRule)rule.RuleType) { case RuleFile.TypeFileRule.Date: rbtDate.IsChecked = true; break; case RuleFile.TypeFileRule.Extension: rbtExtension.IsChecked = true; break; case RuleFile.TypeFileRule.FileName: rbtName.IsChecked = true; break; } RuleControl rControl = (RuleControl)pnlExtensionControl.Children[0]; rControl.SetRule(rule); }