public void Render(WpfXmlWriter writer, RadioButtonList_t control) { string id = WpfControlRenderer.CleanName(control.Id); _log.Debug(m => m("Rendering control {0} of type RadioButtonList_t using {1}", control.Id, this.GetType().FullName)); WpfControlRenderer.RenderLabelledControl <RadioButtonList_t>(writer, control, (c, gridCoordinate) => { using (writer.New(DefaultNamespaceProvider.Atdl4netNamespaceUri, typeof(RadioButtonList).Name)) { writer.WriteAttribute(WpfXmlWriterAttribute.GridColumn, gridCoordinate.Column.ToString()); writer.WriteAttribute(WpfXmlWriterAttribute.GridRow, gridCoordinate.Row.ToString()); writer.WriteAttribute(WpfXmlWriterAttribute.Margin, "1,3,1,3"); if (!string.IsNullOrEmpty(c.Id)) { writer.WriteAttribute(WpfXmlWriterAttribute.Name, id); } writer.WriteAttribute(WpfXmlWriterAttribute.DataContext, string.Format("{{Binding Path=Controls[{0}]}}", id)); writer.WriteAttribute(WpfXmlWriterAttribute.ToolTip, "{Binding Path=ToolTip, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.Orientation, "{Binding Path=Orientation, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.ItemsSource, "{Binding Path=ListItems}"); writer.WriteAttribute(WpfXmlWriterAttribute.IsEnabled, "{Binding Path=Enabled, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.Visibility, "{Binding Path=Visibility, Mode=OneWay}"); } }); }
public void Render(WpfXmlWriter writer, TextField_t control) { string id = WpfControlRenderer.CleanName(control.Id); _log.Debug(m => m("Rendering control {0} of type TextField_t using {1}", control.Id, this.GetType().FullName)); WpfControlRenderer.RenderLabelledControl <TextField_t>(writer, control, (c, gridCoordinate) => { using (writer.New(DefaultNamespaceProvider.Atdl4netNamespaceUri, typeof(ClickSelectTextBox).Name)) { writer.WriteAttribute(WpfXmlWriterAttribute.GridColumn, gridCoordinate.Column.ToString()); writer.WriteAttribute(WpfXmlWriterAttribute.GridRow, gridCoordinate.Row.ToString()); writer.WriteAttribute(WpfXmlWriterAttribute.Margin, "1,3,1,3"); if (!string.IsNullOrEmpty(c.Id)) { writer.WriteAttribute(WpfXmlWriterAttribute.Name, id); } writer.WriteAttribute(WpfXmlWriterAttribute.Width, "120"); writer.WriteAttribute(WpfXmlWriterAttribute.HorizontalAlignment, "Left"); writer.WriteAttribute(WpfXmlWriterAttribute.DataContext, string.Format("{{Binding Path=Controls[{0}]}}", id)); writer.WriteAttribute(WpfXmlWriterAttribute.ToolTip, "{Binding Path=ToolTip, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.Text, "{Binding Path=UiValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"); writer.WriteAttribute(WpfXmlWriterAttribute.IsEnabled, "{Binding Path=Enabled, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.Visibility, "{Binding Path=Visibility, Mode=OneWay}"); } }); }
public void Render(WpfXmlWriter writer, CheckBox_t control) { string id = WpfControlRenderer.CleanName(control.Id); _log.Debug(m => m("Rendering control {0} of type CheckBox_t using {1}", control.Id, this.GetType().FullName)); using (writer.New(WpfXmlWriterTag.CheckBox)) { WpfControlRenderer.WriteGridAttribute(writer, control); // writer.WriteAttribute(WpfXmlWriterAttribute.Margin, "1,5,2,0"); writer.WriteAttribute(WpfXmlWriterAttribute.Margin, "1,8,2,3"); if (!string.IsNullOrEmpty(control.Label)) { writer.WriteAttribute(WpfXmlWriterAttribute.Content, control.Label); } if (!string.IsNullOrEmpty(control.Id)) { writer.WriteAttribute(WpfXmlWriterAttribute.Name, id); } writer.WriteAttribute(WpfXmlWriterAttribute.DataContext, string.Format("{{Binding Path=Controls[{0}]}}", id)); writer.WriteAttribute(WpfXmlWriterAttribute.ToolTip, "{Binding Path=ToolTip, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.IsChecked, "{Binding Path=UiValue, Mode=TwoWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.IsEnabled, "{Binding Path=Enabled, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.Visibility, "{Binding Path=Visibility, Mode=OneWay}"); } }
public void Render(WpfXmlWriter writer, Clock_t control) { string id = WpfControlRenderer.CleanName(control.Id); _log.Debug(m => m("Rendering control {0} of type Clock_t using {1}", control.Id, this.GetType().FullName)); WpfControlRenderer.RenderLabelledControl <Clock_t>(writer, control, (c, gridCoordinate) => { using (writer.New(DefaultNamespaceProvider.Atdl4netNamespaceUri, typeof(TimePicker).Name)) { writer.WriteAttribute(WpfXmlWriterAttribute.GridColumn, gridCoordinate.Column.ToString()); writer.WriteAttribute(WpfXmlWriterAttribute.GridRow, gridCoordinate.Row.ToString()); // TODO: This probably needs to self-configure writer.WriteAttribute(WpfXmlWriterAttribute.Width, "75"); writer.WriteAttribute(WpfXmlWriterAttribute.HorizontalAlignment, "Left"); writer.WriteAttribute(WpfXmlWriterAttribute.Margin, "1,3,1,3"); if (!string.IsNullOrEmpty(c.Id)) { writer.WriteAttribute(WpfXmlWriterAttribute.Name, id); } writer.WriteAttribute(WpfXmlWriterAttribute.DataContext, string.Format("{{Binding Path=Controls[{0}]}}", id)); writer.WriteAttribute(WpfXmlWriterAttribute.ToolTip, "{Binding Path=ToolTip, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.Time, "{Binding Path=UiValue, Mode=TwoWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.IsEnabled, "{Binding Path=Enabled, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.Visibility, "{Binding Path=Visibility, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.IsContentValid, "{Binding Path=IsContentValid, Mode=OneWayToSource}"); } }); }
public void Render(WpfXmlWriter writer, SingleSpinner_t control) { string id = WpfControlRenderer.CleanName(control.Id); _log.Debug(m => m("Rendering control {0} of type SingleSpinner_t using {1}", control.Id, this.GetType().FullName)); WpfControlRenderer.RenderLabelledControl <SingleSpinner_t>(writer, control, (c, gridCoordinate) => { using (writer.New(DefaultNamespaceProvider.Atdl4netNamespaceUri, typeof(SingleSpinner).Name)) { writer.WriteAttribute(WpfXmlWriterAttribute.GridColumn, gridCoordinate.Column.ToString()); writer.WriteAttribute(WpfXmlWriterAttribute.GridRow, gridCoordinate.Row.ToString()); writer.WriteAttribute(WpfXmlWriterAttribute.Margin, "1,3,3,3"); writer.WriteAttribute(WpfXmlWriterAttribute.Width, "120"); writer.WriteAttribute(WpfXmlWriterAttribute.HorizontalAlignment, "Left"); if (!string.IsNullOrEmpty(c.Id)) { writer.WriteAttribute(WpfXmlWriterAttribute.Name, id); } writer.WriteAttribute(WpfXmlWriterAttribute.DataContext, string.Format("{{Binding Path=Controls[{0}]}}", id)); writer.WriteAttribute(WpfXmlWriterAttribute.ToolTip, "{Binding Path=ToolTip, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.Value, "{Binding Path=UiValue, Mode=TwoWay, TargetNullValue={x:Static sys:String.Empty}}"); writer.WriteAttribute(WpfXmlWriterAttribute.Increment, "{Binding Path=UnderlyingControl.Increment, Mode=OneWay, TargetNullValue=1}"); writer.WriteAttribute(WpfXmlWriterAttribute.IsEnabled, "{Binding Path=Enabled, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.Visibility, "{Binding Path=Visibility, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.IsContentValid, "{Binding Path=IsContentValid, Mode=OneWayToSource}"); } }); }
public void Render(WpfXmlWriter writer, EditableDropDownList_t control) { string id = WpfControlRenderer.CleanName(control.Id); _log.Debug(m => m("Rendering control {0} of type EditableDropDownList_t using {1}", control.Id, this.GetType().FullName)); if (Atdl4netConfiguration.Settings.Wpf.View.AutoSizeDropDowns) { WpfControlRenderer.ComboBoxSizer.RegisterComboBox(id, control.ListItems); } WpfControlRenderer.RenderLabelledControl <EditableDropDownList_t>(writer, control, (c, gridCoordinate) => { using (writer.New(WpfXmlWriterTag.ComboBox)) { writer.WriteAttribute(WpfXmlWriterAttribute.GridColumn, gridCoordinate.Column.ToString()); writer.WriteAttribute(WpfXmlWriterAttribute.GridRow, gridCoordinate.Row.ToString()); writer.WriteAttribute(WpfXmlWriterAttribute.Margin, "1,3,1,3"); if (Atdl4netConfiguration.Settings.Wpf.View.AutoSizeDropDowns) { writer.WriteAttribute(WpfXmlWriterAttribute.Width, string.Format("{{Binding Source={{StaticResource {0}}},Path=[{1}]}}", StrategyViewModel.ComboBoxSizerKey, id)); } writer.WriteAttribute(WpfXmlWriterAttribute.IsEditable, "True"); if (!string.IsNullOrEmpty(id)) { writer.WriteAttribute(WpfXmlWriterAttribute.Name, id); } writer.WriteAttribute(WpfXmlWriterAttribute.HorizontalAlignment, "Left"); writer.WriteAttribute(WpfXmlWriterAttribute.DataContext, string.Format("{{Binding Path=Controls[{0}]}}", id)); writer.WriteAttribute(WpfXmlWriterAttribute.ToolTip, "{Binding Path=ToolTip, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.ItemsSource, "{Binding Path=ListItems}"); writer.WriteAttribute(WpfXmlWriterAttribute.SelectedValue, "{Binding Path=SelectedValue}"); writer.WriteAttribute(WpfXmlWriterAttribute.SelectedValuePath, "EnumId"); writer.WriteAttribute(WpfXmlWriterAttribute.DisplayMemberPath, "UiRep"); writer.WriteAttribute(WpfXmlWriterAttribute.Text, "{Binding Path=Text, Mode=TwoWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.IsEnabled, "{Binding Path=Enabled, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.Visibility, "{Binding Path=Visibility, Mode=OneWay}"); } }); }
public void Render(WpfXmlWriter writer, Label_t control) { string id = WpfControlRenderer.CleanName(control.Id); _log.Debug(m => m("Rendering control {0} of type Label_t using {1}", control.Id, this.GetType().FullName)); using (writer.New(WpfXmlWriterTag.Label)) { writer.WriteAttribute(WpfXmlWriterAttribute.Margin, "1,3,1,3"); WpfControlRenderer.WriteGridAttribute(writer, control); writer.WriteAttribute(WpfXmlWriterAttribute.ToolTip, string.Format("{{Binding Path=Controls[{0}].ToolTip}}", id)); writer.WriteAttribute(WpfXmlWriterAttribute.Content, string.Format("{{Binding Path=Controls[{0}].UiValue}}", id)); writer.WriteAttribute(WpfXmlWriterAttribute.IsEnabled, string.Format("{{Binding Path=Controls[{0}].Enabled}}", id)); writer.WriteAttribute(WpfXmlWriterAttribute.Visibility, string.Format("{{Binding Path=Controls[{0}].Visibility}}", id)); writer.WriteAttribute(WpfXmlWriterAttribute.AutomationProperties_AutomationId, id); } }
public void Render(WpfXmlWriter writer, RadioButton_t control) { string id = WpfControlRenderer.CleanName(control.Id); _log.Debug(m => m("Rendering control {0} of type RadioButton_t using {1}", control.Id, this.GetType().FullName)); using (writer.New(WpfXmlWriterTag.RadioButton)) { WpfControlRenderer.WriteGridAttribute(writer, control); writer.WriteAttribute(WpfXmlWriterAttribute.Margin, "1,8,4,3"); if (!string.IsNullOrEmpty(control.Label)) { writer.WriteAttribute(WpfXmlWriterAttribute.Content, control.Label); } if (!string.IsNullOrEmpty(control.Id)) { writer.WriteAttribute(WpfXmlWriterAttribute.Name, id); } // For .NET 4.0 we can rely on GroupName, but for .NET 3.5 we have to provide our own mechanism to // ensure that only one radio button is enabled at a time #if NET462 if (!string.IsNullOrEmpty(control.RadioGroup)) { writer.WriteAttribute(WpfXmlWriterAttribute.GroupName, WpfControlRenderer.CleanName(control.RadioGroup)); } #endif writer.WriteAttribute(WpfXmlWriterAttribute.DataContext, string.Format("{{Binding Path=Controls[{0}]}}", id)); writer.WriteAttribute(WpfXmlWriterAttribute.ToolTip, "{Binding Path=ToolTip, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.IsChecked, "{Binding Path=UiValue, Mode=TwoWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.IsEnabled, "{Binding Path=Enabled, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.Visibility, "{Binding Path=Visibility, Mode=OneWay}"); } }
public void Render(WpfXmlWriter writer, MultiSelectList_t control) { string id = WpfControlRenderer.CleanName(control.Id); _log.Debug(m => m("Rendering control {0} of type MultiSelectList_t using {1}", control.Id, this.GetType().FullName)); if (Atdl4netConfiguration.Settings.Wpf.View.AutoSizeDropDowns) { WpfControlRenderer.ComboBoxSizer.RegisterComboBox(id, control.ListItems); } WpfControlRenderer.RenderLabelledControl <MultiSelectList_t>(writer, control, (c, gridCoordinate) => { using (writer.New(WpfXmlWriterTag.ListBox)) { writer.WriteAttribute(WpfXmlWriterAttribute.GridColumn, gridCoordinate.Column.ToString()); writer.WriteAttribute(WpfXmlWriterAttribute.GridRow, gridCoordinate.Row.ToString()); writer.WriteAttribute(WpfXmlWriterAttribute.Margin, "1,3,1,3"); if (!string.IsNullOrEmpty(id)) { writer.WriteAttribute(WpfXmlWriterAttribute.Name, id); } writer.WriteAttribute(WpfXmlWriterAttribute.DataContext, string.Format("{{Binding Path=Controls[{0}]}}", id)); writer.WriteAttribute(WpfXmlWriterAttribute.ToolTip, "{Binding Path=ToolTip, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.ItemsSource, "{Binding Path=ListItems}"); writer.WriteAttribute(WpfXmlWriterAttribute.SelectionMode, "Multiple"); writer.WriteAttribute(WpfXmlWriterAttribute.VirtualizingStackPanel_IsVirtualizing, "False"); writer.WriteAttribute(WpfXmlWriterAttribute.ItemContainerStyle, "{DynamicResource MultiSelectListItemStyle}"); writer.WriteAttribute(WpfXmlWriterAttribute.IsEnabled, "{Binding Path=Enabled, Mode=OneWay}"); writer.WriteAttribute(WpfXmlWriterAttribute.Visibility, "{Binding Path=Visibility, Mode=OneWay}"); } }); }