void _dataContext_LogoutEvent(bool isForced) { gridContent.Visibility = Visibility.Hidden; gridLayout.Children.Add(gridLogin); loginUI.ClearPassword(); _tbQSearch = null; bdQuikSearch.Child = null; popSearch.PlacementTarget = null; //tabHost.Items.Clear(); for (int i = 0; i < dockPanel.Panes.Count();) { var item = dockPanel.Panes.ElementAt(i); if (item != paneMenu) { item.RemoveFromParent(); } else { i++; } } foreach (var win in this.OwnedWindows) { ((Window)win).Close(); } if (isForced) { this.Dispatcher.Invoke(new Action(() => { //不要忘记this,因为MessageBox是在其它线程创建的 MessageBox.Show(this, "您当前使用账号被强制退出.\n可能相同账号在其它地方登录或控制中心要求您下线,若有疑问请联系系统管理员."); })); } }
private void LoginInit() { CubicEase cubicEase = new CubicEase(); Storyboard sb = new Storyboard(); DoubleAnimation anix = new DoubleAnimation(); anix.Duration = new Duration(TimeSpan.FromMilliseconds(2000)); sb.Children.Add(anix); anix.To = 1000; anix.EasingFunction = cubicEase; Storyboard.SetTargetProperty(anix, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)")); Storyboard.SetTarget(sb, gridLogin); sb.Completed += delegate { gridLayout.Children.Remove(gridLogin); gridContent.Visibility = Visibility.Visible; _tbQSearch = new RadWatermarkTextBox() { Margin = new Thickness(0), BorderThickness = new Thickness(0), Background = null, VerticalContentAlignment = VerticalAlignment.Center, WatermarkContent = "快速查找菜单项" }; _tbQSearch.TextChanged += new TextChangedEventHandler(tbQSearch_TextChanged); bdQuikSearch.Child = _tbQSearch; popSearch.PlacementTarget = _tbQSearch; }; sb.Begin(); }
/// <summary> /// When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call <see cref="M:System.Windows.Controls.Control.ApplyTemplate"/>. In simplest terms, this means the method is called just before a UI element displays in an application. For more information, see Remarks. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); _commentTextBox = GetTemplateChild(CommentTextBoxName) as RadWatermarkTextBox; _addRemoveButton = GetTemplateChild(AddRemoveButtonName) as Button; if (_addRemoveButton != null) { _addRemoveButton.Click += AddRemoveButtonClick; } if (_commentTextBox != null) { _commentTextBox.TextChanged += CommentTextBoxTextChanged; } _templatedApplied = true; if (_addRemoveButton != null) { _addRemoveButton.Content = string.IsNullOrWhiteSpace(Text) ? AddText : RemoveText; } HandleReadOnlyPropertyChanged(); UpdateCommentState(); }
public CustomFilterBehavior(RadGridView gridView, RadWatermarkTextBox textBlock, RadBusyIndicator busyIndicator) { this.gridView = gridView; this.textBlock = textBlock; this.busyIndicator = busyIndicator; this.textBlock.TextChanged -= this.OnTextBlockTextChanged; this.textBlock.TextChanged += this.OnTextBlockTextChanged; }
/// <summary> /// When overridden in a derived class, is invoked whenever application code /// or internal processes (such as a rebuilding layout pass) call System.Windows.Controls.Control.ApplyTemplate(). /// In simplest terms, this means the method is called just before a UI element /// displays in an application. For more information, see Remarks. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate (); _background = GetTemplateChild ( "BackgroundVisual" ) as Border; _dropDown = GetTemplateChild("PART_DropDownButton") as RadDropDownButton; _textBox = GetTemplateChild("PART_DateTimeInput") as RadWatermarkTextBox; SetBinding ( IsReadOnlyWatcherProperty, new Binding { Source = this, Path = new PropertyPath ( "IsReadOnly" ) } ); _textBox.Style = ( Style )Application.Current.Resources["EditableWatermarkTextBoxStyle"]; }
/// <summary> /// When overridden in a derived class, is invoked whenever application code /// or internal processes (such as a rebuilding layout pass) call System.Windows.Controls.Control.ApplyTemplate(). /// In simplest terms, this means the method is called just before a UI element /// displays in an application. For more information, see Remarks. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); _background = GetTemplateChild("BackgroundVisual") as Border; _dropDown = GetTemplateChild("PART_DropDownButton") as RadDropDownButton; _textBox = GetTemplateChild("PART_DateTimeInput") as RadWatermarkTextBox; SetBinding(IsReadOnlyWatcherProperty, new Binding { Source = this, Path = new PropertyPath("IsReadOnly") }); _textBox.Style = ( Style )Application.Current.Resources["EditableWatermarkTextBoxStyle"]; }
private void TextSearchLoaded(object sender, RoutedEventArgs e) { grdFormModels.Focus(); textSearch = grdFormModels.ChildrenOfType <RadWatermarkTextBox>().FirstOrDefault(s => s.Name == "PART_SearchAsYouTypeTextBox"); if (textSearch != null) { textSearch.Focus(); textSearch.PreviewKeyDown += TextSearchPreviewKeyDown; grdFormModels.Items.CollectionChanged += FormCollectionChanged; } }
/// <summary> /// Description: Si no hay texto ingresado cambia el color de letra a gris claro, en caso contrario lo deja en negro /// </summary> private void _textServerPort_tex_TextChanged(object sender, TextChangedEventArgs e) { RadWatermarkTextBox waterMarkTextBox = sender as RadWatermarkTextBox; if (waterMarkTextBox.Text == "") { waterMarkTextBox.Foreground = Brushes.LightGray; } else { waterMarkTextBox.Foreground = Brushes.Black; } }
/// <summary> /// Description: Si no hay texto ingresado cambia el color de letra a gris claro, en caso contrario lo deja en negro /// </summary> private void PART_SearchAsYouTypeTextBox_TextChanged(object sender, TextChangedEventArgs e) { RadWatermarkTextBox waterMarkTextBox = sender as RadWatermarkTextBox; if (waterMarkTextBox.Text == "") { waterMarkTextBox.Foreground = Brushes.LightGray; } else { waterMarkTextBox.Foreground = Brushes.Black; } }
private void TextSearchLoaded(object sender, RoutedEventArgs e) { GrdBanks.Focus(); textSearch = GrdBanks.ChildrenOfType <RadWatermarkTextBox>().FirstOrDefault(s => s.Name == "PART_SearchAsYouTypeTextBox"); if (textSearch != null) { textSearch.Focus(); textSearch.PreviewKeyDown += TextSearchPreviewKeyDown;; GrdBanks.Items.CollectionChanged += GrdBankCollectionChanged; manageOwnersViewModel = (ManageOwnersViewModel)DataContext; } var closeButton = GrdBanks.ChildrenOfType <RadPathButton>().FirstOrDefault(b => b.Name == "CloseButton"); if (closeButton != null) { closeButton.Visibility = Visibility.Collapsed; } }
/// <summary> /// When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call <see cref="M:System.Windows.Controls.Control.ApplyTemplate"/>. In simplest terms, this means the method is called just before a UI element displays in an application. For more information, see Remarks. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate (); _commentTextBox = GetTemplateChild ( CommentTextBoxName ) as RadWatermarkTextBox; _addRemoveButton = GetTemplateChild ( AddRemoveButtonName ) as Button; if ( _addRemoveButton != null ) { _addRemoveButton.Click += AddRemoveButtonClick; } if ( _commentTextBox != null ) { _commentTextBox.TextChanged += CommentTextBoxTextChanged; } _templatedApplied = true; if ( _addRemoveButton != null ) { _addRemoveButton.Content = string.IsNullOrWhiteSpace ( Text ) ? AddText : RemoveText; } HandleReadOnlyPropertyChanged (); UpdateCommentState (); }