本文整理汇总了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);
}
示例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;
}
示例3: FormatDropDown
private static UserControl FormatDropDown(UserControl control)
{
control.HorizontalAlignment = HorizontalAlignment.Left;
control.Width = 300;
control.Margin = new Thickness(5);
return control;
}
示例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();
}
示例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();
}
示例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")));
}
示例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;
}
示例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();
}
示例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];
}
示例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");
}
}
示例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();
}
示例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);
}
示例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);
}
}
示例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);
}
示例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;
}