protected DataEntryControl(ControlRow control, DataEntryControls styleProvider) { // populate properties from database definition of control // this.Content and Tooltip can't be set, however, as the caller hasn't instantiated the content control yet this.Copyable = control.Copyable; this.DataLabel = control.DataLabel; this.DefaultValue = control.DefaultValue; // Create the stack panel this.Container = new StackPanel(); Style style = styleProvider.FindResource(Constant.ControlStyle.ContainerStyle) as Style; this.Container.Style = style; // use the containers's tag to point back to this so event handlers can access the DataEntryControl // this is needed by callbacks such as DataEntryHandler.Container_PreviewMouseRightButtonDown() and CarnassialWindow.CounterControl_MouseLeave() this.Container.Tag = this; }
private ComboBox CreateComboBox(DataEntryControls styleProvider, ControlRow control) { ComboBox comboBox = new ComboBox(); comboBox.ToolTip = control.Tooltip; comboBox.Width = control.Width; foreach (string choice in control.GetChoices()) { comboBox.Items.Add(choice); } comboBox.SelectedIndex = 0; Style style = styleProvider.FindResource(ControlContentStyle.ChoiceComboBox.ToString()) as Style; comboBox.Style = style; return comboBox; }
private TextBox CreateTextBox(DataEntryControls styleProvider, ControlRow control) { TextBox textBox = new TextBox(); textBox.Text = control.DefaultValue; textBox.ToolTip = control.Tooltip; textBox.Width = control.Width; Style style = styleProvider.FindResource(ControlContentStyle.NoteCounterTextBox.ToString()) as Style; textBox.Style = style; return textBox; }
// Returns a stack panel containing two controls // The stack panel ensures that controls are layed out as a single unit with certain spatial characteristcs // i.e., a given height, right margin, where contents will not be broken durring (say) panel wrapping private StackPanel CreateStackPanel(DataEntryControls styleProvider, Control label, Control content) { StackPanel stackPanel = new StackPanel(); stackPanel.Children.Add(label); stackPanel.Children.Add(content); Style style = styleProvider.FindResource(Constant.ControlStyle.ContainerStyle) as Style; stackPanel.Style = style; return stackPanel; }
private Label CreateLabel(DataEntryControls styleProvider, ControlRow control) { Label label = new Label(); label.Content = control.Label; label.ToolTip = control.Tooltip; Style style = styleProvider.FindResource(ControlLabelStyle.DefaultLabel.ToString()) as Style; label.Style = style; return label; }
private CheckBox CreateFlag(DataEntryControls styleProvider, ControlRow control) { CheckBox checkBox = new CheckBox(); checkBox.Visibility = Visibility.Visible; checkBox.ToolTip = control.Tooltip; Style style = styleProvider.FindResource(ControlContentStyle.FlagCheckBox.ToString()) as Style; checkBox.Style = style; return checkBox; }
private RadioButton CreateCounterLabelButton(DataEntryControls styleProvider, ControlRow control) { RadioButton radioButton = new RadioButton(); radioButton.GroupName = "DataEntryCounter"; radioButton.Content = control.Label; radioButton.ToolTip = control.Tooltip; Style style = styleProvider.FindResource(ControlLabelStyle.CounterButton.ToString()) as Style; radioButton.Style = style; return radioButton; }