public MainWindow() { InitializeComponent(); //Demo purposes only //due to how this demo was implemented this code runs after the OnInitialezed //of our custom control. Meaning this won;t accurately update the ChildCount value. _stackPanel.SetValue(MyCustomControl.IncludeChildCountProperty, true); MyCustomControl.SetIncludeChildCount(_stackPanel, true); }
public object Convert( object value, Type targetType, object parameter, CultureInfo culture) { var control = new MyCustomControl(); control.SetBinding(MyCustomControl.TextProperty, new Binding("Text") { Source = value }); control.SetBinding(MyCustomControl.ParameterProperty, new Binding("Parameters") { Source = value }); return(control); }
public CustomControlForm() { InitializeComponent(); var myHostControl = new Microsoft.Toolkit.Forms.UI.XamlHost.WindowsXamlHost(); myHostControl.Dock = DockStyle.Fill; myHostControl.Name = "uwpHost"; var customControl = new MyCustomControl(); customControl.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch; customControl.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch; myHostControl.Child = customControl; this.Controls.Add(myHostControl); }
private static IControlBaseProperty MyControlBoxBase_AddControlEvent(JObject oTemp, int kind) { IControlBaseProperty vwT = null; switch (kind) { case 2018: //查询返回 { vwT = new MyCustomControl(oTemp); } break; } if (vwT != null) { if (vwT.IsControlCreateSuccess) { return(vwT); } } return(null); }
private static void OnProgressValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { //throw new NotImplementedException(); MyCustomControl circularProgressBar = d as MyCustomControl; if (circularProgressBar != null) { double r = 19; double x0 = 20; double y0 = 20; circularProgressBar.myArc.Size = new Size(19, 19); double angle = 90 - (double)e.NewValue / 100 * 360; double radAngle = angle * (PI / 180); double x = x0 + r * Cos(radAngle); double y = y0 - r * Sin(radAngle); if (circularProgressBar.myArc != null) { circularProgressBar.myArc.IsLargeArc = ((double)e.NewValue >= 50); circularProgressBar.myArc.Point = new Point(x, y); } } }
public static IHtmlContent MyCustomControl(this IHtmlHelper html) { var result = new MyCustomControl(); return(html.Raw(result.Render())); }