Inheritance: ContentControl
コード例 #1
0
        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);
        }
コード例 #2
0
    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);
    }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
	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);
			}
		}
	}
コード例 #6
0
    public static IHtmlContent MyCustomControl(this IHtmlHelper html)
    {
        var result = new MyCustomControl();

        return(html.Raw(result.Render()));
    }