• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Controls.UserControl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Detach

 public void Detach(UserControl target)
 {
     target.KeyDown -= target_KeyDown;
     target.KeyUp -= target_KeyUp;
     target.LostFocus -= target_LostFocus;
     CurrentKeyboardState.ClearKeyPresses();
 }
开发者ID:danzel,项目名称:FarseerPhysics,代码行数:7,代码来源:InputState.cs


示例17: InitializeComponent

 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/%E5%A5%A5%E6%9E%AB%E7%87%83%E6%B0%94%E8%90%A5%E6%94%B6%E7%B3%BB%E7%BB%9FV3;compo" +
                 "nent/MainPage.xaml", System.UriKind.Relative));
     this.mainpage = ((System.Windows.Controls.UserControl)(this.FindName("mainpage")));
     this.MainCanvasStoryboardIn = ((System.Windows.Media.Animation.Storyboard)(this.FindName("MainCanvasStoryboardIn")));
     this.MainCanvasStoryboardOut = ((System.Windows.Media.Animation.Storyboard)(this.FindName("MainCanvasStoryboardOut")));
     this.MainCanvasrightStoryboardIn = ((System.Windows.Media.Animation.Storyboard)(this.FindName("MainCanvasrightStoryboardIn")));
     this.MainCanvasrightStoryboardOut = ((System.Windows.Media.Animation.Storyboard)(this.FindName("MainCanvasrightStoryboardOut")));
     this.CanvasBottomStoryboard = ((System.Windows.Media.Animation.Storyboard)(this.FindName("CanvasBottomStoryboard")));
     this.da = ((System.Windows.Media.Animation.DoubleAnimation)(this.FindName("da")));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.openchild = ((Com.Aote.ObjectTools.ChildWindowObj)(this.FindName("openchild")));
     this.selects = ((Com.Aote.ObjectTools.ObjectList)(this.FindName("selects")));
     this.canvasleft = ((System.Windows.Controls.Canvas)(this.FindName("canvasleft")));
     this.canvasbottom = ((System.Windows.Controls.Canvas)(this.FindName("canvasbottom")));
     this.frame = ((System.Windows.Controls.Grid)(this.FindName("frame")));
     this.menus = ((Microsoft.Expression.Controls.PathListBox)(this.FindName("menus")));
     this.plblp = ((Microsoft.Expression.Controls.LayoutPath)(this.FindName("plblp")));
     this.path = ((System.Windows.Shapes.Path)(this.FindName("path")));
     this.loginUserInfo = ((System.Windows.Controls.Canvas)(this.FindName("loginUserInfo")));
 }
开发者ID:DuBin1988,项目名称:anjian_pad_server,代码行数:25,代码来源:MainPage.g.i.cs


示例18: WhenCalledConvert_RegistersNonSharedView

        public void WhenCalledConvert_RegistersNonSharedView()
        {
            //Arrange
            var converter = new TopLevelViewConverter();

            var mockRouter = Mock.Create<IViewModelRouter>();
            const string viewModelTag = "testViewModel";
            const string viewTag = "testView";

            Mock.Arrange(() => mockRouter.GetViewTagsForViewModel(Arg.IsAny<string>())).Returns(new[] { viewTag });
            var view = new UserControl();
            Mock.Arrange(() => mockRouter.GetNonSharedView(Arg.IsAny<string>(), Arg.IsAny<object>())).Returns(view);

            var mockWindow = Mock.Create<ITopLevelWindow>();
            Mock.Arrange(() => mockWindow.GetExportAsViewModelAttribute()).Returns(new ExportAsViewModelAttribute(viewModelTag));
            converter.Router = new Lazy<IViewModelRouter>(() => mockRouter);
            converter.Views = new[] { new Lazy<UserControl, IExportAsViewMetadata>(() => view, new ExportAsViewAttribute(viewTag)), };
            Mock.Arrange(() => TopLevelViewConverter.ComposedConverter).Returns(new TopLevelViewConverter());

            // Act
            converter.Convert(mockWindow, new TypeDelegator(typeof(object)), null, null);

            // Assert
            Assert.IsTrue(converter.IsRegistered(mockWindow));
        }
开发者ID:mparsin,项目名称:Elements,代码行数:25,代码来源:TopLevelWindowConverterTests.cs


示例19: DialogViewModel

        public DialogViewModel(UserControl content, DialogButtonModel button1, DialogButtonModel button2 = null, DialogButtonModel button3 = null)
        {
            DialogContent = content;
            Button1Command = button1.ButtonCommand;
            Button1Content = button1.Content;
            IsButton1Default = button1.IsDefault;
            IsButton1Cancel = button1.IsCancel;

            if(button2 != null)
            {
                Button2Command = button2.ButtonCommand;
                Button2Content = button2.Content;
                IsButton2Default = button2.IsDefault;
                IsButton2Cancel = button2.IsCancel;
            }
            else
            {
                IsButton2Visible = false;
            }

            if (button3 != null)
            {
                Button3Command = button3.ButtonCommand;
                Button3Content = button3.Content;
                IsButton3Default = button3.IsDefault;
                IsButton3Cancel = button3.IsCancel;
            }
            else
            {
                IsButton3Visible = false;
            }
        }
开发者ID:simon-knox,项目名称:SafeAndSound2014,代码行数:32,代码来源:DialogViewModel.cs


示例20: ActivateDim

        public void ActivateDim(UserControl control, Boolean playAnimation = true)
        {
            dimMessageControl = control ?? dimMessageControl;
            gridDim.Visibility = Visibility.Visible;

            if (playAnimation) BeginStoryboard((Storyboard)FindResource("DimControlActivationStoryboard"));
        }
开发者ID:AleksandarDev,项目名称:Project---Metro-Tables,代码行数:7,代码来源:HomePage.xaml.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Controls.ValidationErrorEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Controls.UIElementCollection类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap