当前位置: 首页>>代码示例>>C#>>正文


C# Controls.UserControl类代码示例

本文整理汇总了C#中System.Windows.Controls.UserControl的典型用法代码示例。如果您正苦于以下问题:C# UserControl类的具体用法?C# UserControl怎么用?C# UserControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UserControl类属于System.Windows.Controls命名空间,在下文中一共展示了UserControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Game

        public Game(UserControl userControl, Canvas drawingCanvas, Canvas debugCanvas, TextBlock txtDebug)
        {
            //Initialize
            IsActive = true;
            IsFixedTimeStep = true;
            TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16);
            Components = new List<DrawableGameComponent>();
            World = new World(new Vector2(0, 0));
            _gameTime = new GameTime();
            _gameTime.GameStartTime = DateTime.Now;
            _gameTime.FrameStartTime = DateTime.Now;
            _gameTime.ElapsedGameTime = TimeSpan.Zero;
            _gameTime.TotalGameTime = TimeSpan.Zero;

            //Setup Canvas
            DrawingCanvas = drawingCanvas;
            DebugCanvas = debugCanvas;
            TxtDebug = txtDebug;
            UserControl = userControl;

            //Setup GameLoop
            _gameLoop = new Storyboard();
            _gameLoop.Completed += GameLoop;
            _gameLoop.Duration = TargetElapsedTime;
            DrawingCanvas.Resources.Add("gameloop", _gameLoop);
        }
开发者ID:hilts-vaughan,项目名称:Farseer-Physics,代码行数:26,代码来源:Game.cs

示例2: actAddTab

        public void actAddTab(request request, UserControl view)
        {
            Tab tab = new Tab(request.creation_date.ToString(), view , request, null);

            requestTabs.Add(tab);
            this.selectedTab = tab;
        }
开发者ID:rtherisod,项目名称:EducomManager,代码行数:7,代码来源:RequestViewModel.cs

示例3: FormatDropDown

 private static UserControl FormatDropDown(UserControl control)
 {
     control.HorizontalAlignment = HorizontalAlignment.Left;
     control.Width = 300;
     control.Margin = new Thickness(5);
     return control;
 }
开发者ID:e82eric,项目名称:Prompts,代码行数:7,代码来源:PromptDataTemplateSelector.xaml.cs

示例4: LoginWindowViewModel

        public LoginWindowViewModel(UserControl view)
        {
            this.view = view as LoginView;

            UseSession = Settings.UserSettings.ContainsKey("UseSessionID") ? bool.Parse(Settings.UserSettings["UseSessionID"]) : false;

            Email = Settings.UserSettings["AccountLogin"];
            this.formChanged = string.IsNullOrEmpty(Settings.UserSettings["AccountPassword"]);

            if (!this.formChanged)
                this.view.txtPassword.Password = string.Empty.PadLeft(8); //For the visuals

            this.view.txtPassword.PasswordChanged += new System.Windows.RoutedEventHandler(txtPassword_PasswordChanged);

            statusController = new StatusController(this.view.StatusBox);

            ApplicationState.Model.Authenticating += model_Authenticating;
            ApplicationState.Model.Throttled += model_Throttled;
            ApplicationState.InitializeFont(Properties.Resources.fontin_regular_webfont);
            ApplicationState.InitializeFont(Properties.Resources.fontin_smallcaps_webfont);

            statusController.DisplayMessage(ApplicationState.Version + " Initialized.\r");

            VersionChecker.CheckForUpdates();
        }
开发者ID:Jocaetano,项目名称:Procurement,代码行数:25,代码来源:LoginWindowViewModel.cs

示例5: ChangeScreen

        public void ChangeScreen(UserControl screen)
        {
            //foreach (var element in MainDock.Children)
            //{
            //    if (element.GetType().Name == "LoadingScreen")
            //    {
            //        MainDock.Children.Remove((UIElement) element);
            //    }
            //}

            if (screen.GetType().Name == "RemoteControlScreen")
            {
                OnRemoteCategory();
            }
            else
            {
                OnStoreCategory();
            }
            var lastElement = MainDock.Children[MainDock.Children.Count - 1];
            //if (lastElement.GetType() == screen.GetType())
            //{
            //    return;
            //}
            MainDock.Children.Remove(lastElement);
            MainDock.Children.Add(screen);

            //GC.Collect();
            //GC.WaitForPendingFinalizers();
        }
开发者ID:huucp,项目名称:tuneRobo,代码行数:29,代码来源:MainWindow.xaml.cs

示例6: InitializeComponent

 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/BuscaRutaParalelo;component/MainPage.xaml", System.UriKind.Relative));
     this.uc = ((System.Windows.Controls.UserControl)(this.FindName("uc")));
     this.g1 = ((System.Windows.Controls.Grid)(this.FindName("g1")));
     this.button1 = ((System.Windows.Controls.Button)(this.FindName("button1")));
     this.checkBox1 = ((System.Windows.Controls.CheckBox)(this.FindName("checkBox1")));
     this.textBox1 = ((System.Windows.Controls.TextBox)(this.FindName("textBox1")));
     this.textBox2 = ((System.Windows.Controls.TextBox)(this.FindName("textBox2")));
     this.label3 = ((System.Windows.Controls.Label)(this.FindName("label3")));
     this.label4 = ((System.Windows.Controls.Label)(this.FindName("label4")));
     this.textBlock1 = ((System.Windows.Controls.TextBlock)(this.FindName("textBlock1")));
     this.label5 = ((System.Windows.Controls.Label)(this.FindName("label5")));
     this.label6 = ((System.Windows.Controls.Label)(this.FindName("label6")));
     this.button2 = ((System.Windows.Controls.Button)(this.FindName("button2")));
     this.radioButton1 = ((System.Windows.Controls.RadioButton)(this.FindName("radioButton1")));
     this.radioButton2 = ((System.Windows.Controls.RadioButton)(this.FindName("radioButton2")));
     this.textBox3 = ((System.Windows.Controls.TextBox)(this.FindName("textBox3")));
     this.scrollViewer1 = ((System.Windows.Controls.ScrollViewer)(this.FindName("scrollViewer1")));
     this.canvas1 = ((System.Windows.Controls.Canvas)(this.FindName("canvas1")));
     this.radioButton3 = ((System.Windows.Controls.RadioButton)(this.FindName("radioButton3")));
 }
开发者ID:rgap,项目名称:City-Routes-Planner,代码行数:25,代码来源:MainPage.g.cs

示例7: ModuleObject

 public ModuleObject(string displayName, UserControl contentControl, IValueHelper<bool> canSaveHelper)
 {
     DisplayName = displayName;
     ContentControl = contentControl;
     IsAvailableHelper = new ValueHelper<bool>() { Value = true/*Starts available by default*/ };
     CanSaveHelper = canSaveHelper;
 }
开发者ID:alaincao,项目名称:CommonLibs,代码行数:7,代码来源:ModuleObject.cs

示例8: FarseerPhysicsGame

        public FarseerPhysicsGame(UserControl userControl, Canvas drawingCanvas, Canvas debugCanvas, TextBlock txtFPS, TextBlock txtDebug)
            : base(userControl, drawingCanvas, debugCanvas, txtDebug)
        {
            TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16);
            IsFixedTimeStep = true;

            //new-up components and add to Game.Components
            ScreenManager = new ScreenManager(this);
            Components.Add(ScreenManager);

            if (txtFPS != null)
            {
                FrameRateCounter frameRateCounter = new FrameRateCounter(ScreenManager, txtFPS);
                Components.Add(frameRateCounter);
            }

            Demo1Screen demo1 = new Demo1Screen();
            Demo2Screen demo2 = new Demo2Screen();
            Demo3Screen demo3 = new Demo3Screen();
            Demo4Screen demo4 = new Demo4Screen();
            Demo5Screen demo5 = new Demo5Screen();
            Demo6Screen demo6 = new Demo6Screen();
            Demo7Screen demo7 = new Demo7Screen();
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo1.GetTitle(), demo1);
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo2.GetTitle(), demo2);
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo3.GetTitle(), demo3);
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo4.GetTitle(), demo4);
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo5.GetTitle(), demo5);
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo6.GetTitle(), demo6);
            ScreenManager.MainMenuScreen.AddMainMenuItem(demo7.GetTitle(), demo7);

            ScreenManager.GoToMainMenu();
        }
开发者ID:tinco,项目名称:Farseer-Physics,代码行数:33,代码来源:FarseerPhysicsGame.cs

示例9: CreateVideoBackgroundGrid

	public Grid CreateVideoBackgroundGrid (UserControl RootPage, String BackgroundPictureFileName,
								int [] ColumnWidths, int [] RowHeights)
		{
		Grid [] Grids = GetVideoFramedGrid (ColumnWidths, RowHeights);
		RootPage.Content = Grids [0];
		BrushConverter BRConverter = new BrushConverter ();
		RootPage.Background = (Brush) BRConverter.ConvertFromString ("Black");
		Image BackGroundImage = new Image ();
		Grids [0].Children.Insert (0, BackGroundImage);
		Grid.SetColumnSpan (BackGroundImage, 3);
		Grid.SetRowSpan (BackGroundImage, 3);
		BitmapImage BackGroundBitmap = new BitmapImage ();
		BackGroundBitmap.CacheOption = BitmapCacheOption.OnLoad;

		if ((BackgroundPictureFileName != null)
			&& (File.Exists (BackgroundPictureFileName)))
			{
			BackGroundBitmap.BeginInit ();
			BackGroundBitmap.UriSource = new Uri (BackgroundPictureFileName);
//			BackGroundBitmap.DecodePixelHeight = m_CVM.VideoHeight;
			BackGroundBitmap.DecodePixelWidth = m_CVM.VideoWidth;
			BackGroundBitmap.EndInit ();
			BackGroundImage.Source = BackGroundBitmap;
			BackGroundImage.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
			//BackGroundImage.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
			InsertDisposeableElement (BackGroundImage);
			}
		return Grids [1];
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:29,代码来源:XAMLHandling.cs

示例10: InitializeComponent

 public void InitializeComponent()
 {
     if (!this._contentLoaded)
     {
         this._contentLoaded = true;
         Application.LoadComponent(this, new Uri("/TWC.OVP;component/Views/CaptionSettingsView.xaml", UriKind.Relative));
         this.userControl = (UserControl) base.FindName("userControl");
         this.LayoutRoot = (Grid) base.FindName("LayoutRoot");
         this.DialogBorder = (Border) base.FindName("DialogBorder");
         this.BackgroundRectangle = (Border) base.FindName("BackgroundRectangle");
         this.Gradient = (Rectangle) base.FindName("Gradient");
         this.HeaderGrid = (Grid) base.FindName("HeaderGrid");
         this.GlyphCanvas = (Canvas) base.FindName("GlyphCanvas");
         this.BoxPath = (Path) base.FindName("BoxPath");
         this.CPath1 = (Path) base.FindName("CPath1");
         this.CPath2 = (Path) base.FindName("CPath2");
         this.CheckedBoxPath = (Path) base.FindName("CheckedBoxPath");
         this.CheckedCPath1 = (Path) base.FindName("CheckedCPath1");
         this.CheckedCPath2 = (Path) base.FindName("CheckedCPath2");
         this.CaptionSettingsLayoutRoot = (Grid) base.FindName("CaptionSettingsLayoutRoot");
         this.MetaDataBackground = (Rectangle) base.FindName("MetaDataBackground");
         this.CharacterSettingsLayoutRoot = (Grid) base.FindName("CharacterSettingsLayoutRoot");
         this.FooterGrid = (Grid) base.FindName("FooterGrid");
         this.DefaultsButton = (Button) base.FindName("DefaultsButton");
         this.CloseButton = (Button) base.FindName("CloseButton");
     }
 }
开发者ID:BigBri41,项目名称:TWCTVWindowsPhone,代码行数:27,代码来源:CaptionSettingsView.cs

示例11: PerformTranstition

        public override void PerformTranstition(UserControl newPage, UserControl oldPage)
        {
            this.newPage = newPage;
            this.oldPage = oldPage;

            Duration duration = new Duration(TimeSpan.FromSeconds(1));

            DoubleAnimation animation = new DoubleAnimation();
            animation.Duration = duration;
            switch (direction)
            {
                case WipeDirection.LeftToRight:
                    animation.To = oldPage.ActualWidth;
                    break;
                case WipeDirection.RightToLeft:
                    animation.To = -oldPage.ActualWidth;
                    break;
            }

            Storyboard sb = new Storyboard();
            sb.Duration = duration;
            sb.Children.Add(animation);
            sb.Completed += sb_Completed;

            TranslateTransform sc = new TranslateTransform();
            oldPage.RenderTransform = sc;

            Storyboard.SetTarget(animation, sc);
            Storyboard.SetTargetProperty(animation, new PropertyPath("X"));

            //oldPage.Resources.Add(sb);

            sb.Begin();
        }
开发者ID:kuki89,项目名称:IP_Lab,代码行数:34,代码来源:WipeTransition.cs

示例12: Add

        public void Add(UserControl layer) {
            LayersList.Children.Add(layer);
            ((ILayer)layer).Closing += layer_Closing;
            this.Height += layer.Height;

            ((ILayerContainer)Window.GetWindow(this)).AdjustHeight(layer.Height);
        }
开发者ID:kernelOfTruth,项目名称:NaturalGroundingPlayer,代码行数:7,代码来源:LayersControl.xaml.cs

示例13: AddCustomTab

        public void AddCustomTab(TabControl parentTabControl, string name, UserControl userControl, bool useViewBox = true)
        {
            if (useViewBox)
            {
                Viewbox viewBox = new Viewbox();
                viewBox.Child = userControl;
                viewBox.Width = double.NaN;
                viewBox.Height = double.NaN;

                TabItem tabItem = new TabItem();
                tabItem.Header = name;
                tabItem.Content = viewBox;
                CopyFontData(tabItem1, tabItem);
                parentTabControl.Items.Add(tabItem);
            }
            else
            {
                userControl.Width = double.NaN;
                userControl.Height = double.NaN;
                userControl.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                userControl.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;

                Grid grid = new Grid();
                grid.Width = double.NaN;
                grid.Height = double.NaN;
                grid.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                grid.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;

                grid.Children.Add(userControl);
                Grid.SetColumn(userControl, 0);
                Grid.SetRow(userControl, 0);

                AddCustomTab(parentTabControl, name, grid);
            }
        }
开发者ID:vesteksoftware,项目名称:VT5021,代码行数:35,代码来源:ManualExtended.cs

示例14: setDisplacement

        private static void setDisplacement(UserControl equi,Point disPoint) {
            Point dp = new Point();
            dp.X = -disPoint.X + equi.Margin.Left;
            dp.Y = disPoint.Y + equi.Margin.Top;
            equi.Margin = new Thickness(dp.X,0,0,0);

        }
开发者ID:ychost,项目名称:PowerControlSimulation,代码行数:7,代码来源:EquipmentScaleUtilis.cs

示例15: Validate

        public string Validate(UserControl form)
        {
            //  _Resource = VSDApp.com.rta.vsd.hh.localisation.Resources.GetInstance();
            vsd.hh.ui.ucDefectAndViolationDetails validateForm = (vsd.hh.ui.ucDefectAndViolationDetails)form;
            string Valid = "";
            bool validity = true;
            //implement Validation Checks here

            if (validateForm.txtDriverLiscenseNumber.Text == "")
            {
                validity = false;
                Valid += "يرجى إدخال رقم رخصة القيادة" + "\n";
                // Valid += _Resource.GetString("Driver License not entered") + "\n";
                validateForm.txtDriverLiscenseNumber.Focus();
            }
            if ((string)validateForm.cmboxCountry.Text == null || (string)validateForm.cmboxCountry.Text == "")
            {

                Valid += "يرجى إدخال " + "\n";
                // Valid += _Resource.GetString("Driver License not entered") + "\n";
                if (validity)
                    validateForm.cmboxCountry.Focus();
                validity = false;
            }
            if (validity)
                Valid = "Valid";
            return Valid;
        }
开发者ID:juniiikhan,项目名称:VDCS,代码行数:28,代码来源:DriverInfoArValidation.cs


注:本文中的System.Windows.Controls.UserControl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。