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, 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}"); } }