protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects) if (_control != null) { _control.DataContextChanged -= Control_DataContextChanged; _control.TryDispose(); _control = null; } if (_viewModel != null) { _viewModel.ErrorsChanged -= NotifyDataErrorInfo_ErrorsChanged; _viewModel = null; } if (_errorPopup != null) { _errorPopup.TryDispose(); _errorPopup = null; } } // TODO: free unmanaged resources (unmanaged objects) and override finalizer // TODO: set large fields to null _disposedValue = true; } }
private void replyRowsItem_Tapped(object sender, TappedRoutedEventArgs e) { if (sender is FrameworkElement frameworkElement) { var popup = new Windows.UI.Xaml.Controls.Primitives.Popup(); popup.Child = new ReplyDialogPresenter(frameworkElement.Tag, popup); Tools.ShowPopup(popup); } }
private static void UpdatePopupBounds(Popup p, Rect rect) { p.HorizontalOffset = rect.X; p.VerticalOffset = rect.Y; var child = (FrameworkElement)p.Child; child.Width = rect.Width; child.Height = rect.Height; }
private void OnPress(Point point) { var child = CreateChild(); Popup = new Popup { IsOpen = true, IsHitTestVisible = false, Child = child }; Origin = point; UpdatePopupBounds(Popup, new Rect(Origin, Origin)); }
public ValidationBroker(FrameworkElement frameworkElement, string propertyName) { this.Log().Debug("Created ValidationBroker"); _control = frameworkElement; _propertyName = propertyName; _control.DataContextChanged += Control_DataContextChanged; _errorPopup = new Popup(); var r = new Rectangle(); r.Width = 8; r.Fill = RedBrush; _errorPopup.Child = r; }
public RadialMenu() { this.DefaultStyleKey = typeof(RadialMenu); _items = new RadialMenuItemCollection(); Loaded += RadialMenu_Loaded; //Unloaded += RadialMenu_Unloaded; HorizontalAlignment = HorizontalAlignment.Left; VerticalAlignment = VerticalAlignment.Top; IsHitTestVisible = false; _popup = new Windows.UI.Xaml.Controls.Primitives.Popup(); _popup.IsLightDismissEnabled = false; BindingOperations.SetBinding(_popup, Windows.UI.Xaml.Controls.Primitives.Popup.IsOpenProperty, new Binding() { Mode = BindingMode.TwoWay, Source = this, Path = new PropertyPath("IsOpen") }); _popup.Child = this; _popup.Opened += _popup_Opened; _popup.Closed += _popup_Closed; //UpdatePopupSize(); lowerThan14393 = !ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3); }
public void InitializeComponent() { if (_contentLoaded) return; _contentLoaded = true; Application.LoadComponent(this, new System.Uri("ms-appx:///Principal.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application); tbAhorcado = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbAhorcado"); imgAhorcado = (Windows.UI.Xaml.Controls.Image)this.FindName("imgAhorcado"); tbPalabra = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbPalabra"); txtLetra = (Windows.UI.Xaml.Controls.TextBox)this.FindName("txtLetra"); tbPuntos = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbPuntos"); barra = (Windows.UI.Xaml.Controls.AppBar)this.FindName("barra"); tbUsadas = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbUsadas"); btnResolver = (Windows.UI.Xaml.Controls.Button)this.FindName("btnResolver"); popupfin = (Windows.UI.Xaml.Controls.Primitives.Popup)this.FindName("popupfin"); popupsexo = (Windows.UI.Xaml.Controls.Primitives.Popup)this.FindName("popupsexo"); tbMensaje = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("tbMensaje"); menubar = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("menubar"); btnJ1 = (Windows.UI.Xaml.Controls.Button)this.FindName("btnJ1"); }
private void WindowsXamlHost_Loaded(object sender, RoutedEventArgs e) { windows.UI.Xaml.Controls.StackPanel stackPanel = new windows.UI.Xaml.Controls.StackPanel() { Background = new windows.UI.Xaml.Media.SolidColorBrush(windows.UI.Colors.Black), }; stackPanel.Children.Add(new windows.UI.Xaml.Shapes.Rectangle() { Width = 50, Height = 75, Fill = new windows.UI.Xaml.Media.SolidColorBrush(windows.UI.Colors.Blue), }); stackPanel.Children.Add(new windows.UI.Xaml.Shapes.Rectangle() { Width = 200, Height = 30, Fill = new windows.UI.Xaml.Media.SolidColorBrush(windows.UI.Colors.Red), }); var button = new windows.UI.Xaml.Controls.Button() { Width = 160, Height = 60, HorizontalAlignment = windows.UI.Xaml.HorizontalAlignment.Center, Content = "ContentDialog UWP Button", }; button.Tapped += Button_Tapped; stackPanel.Children.Add(button); stackPanel.Children.Add(new windows.UI.Xaml.Shapes.Rectangle() { Width = 25, Height = 100, Fill = new windows.UI.Xaml.Media.SolidColorBrush(windows.UI.Colors.Green), }); windows.UI.Xaml.Controls.Flyout flyout = new windows.UI.Xaml.Controls.Flyout(); flyout.Content = new windows.UI.Xaml.Controls.TextBlock() { Text = "Flyout content", }; var button2 = new windows.UI.Xaml.Controls.Button() { Width = 300, Height = 40, HorizontalAlignment = windows.UI.Xaml.HorizontalAlignment.Center, Content = "Long UWP Button with Flyout", Flyout = flyout, }; stackPanel.Children.Add(button2); var comboBox = new windows.UI.Xaml.Controls.ComboBox() { HorizontalAlignment = windows.UI.Xaml.HorizontalAlignment.Center, }; comboBox.Items.Add("One"); comboBox.Items.Add("Two"); comboBox.Items.Add("Three"); comboBox.Items.Add("Four"); stackPanel.Children.Add(comboBox); windows.UI.Xaml.Controls.Grid grid = new windows.UI.Xaml.Controls.Grid(); stackPanel.Children.Add(grid); _contentDialog = new windows.UI.Xaml.Controls.ContentDialog(); _contentDialog.Content = new windows.UI.Xaml.Controls.TextBlock() { Text = "ContentDialog content", }; stackPanel.Children.Add(_contentDialog); var popup = new windows.UI.Xaml.Controls.Primitives.Popup() { Width = 50, Height = 50, ShouldConstrainToRootBounds = false, Child = new windows.UI.Xaml.Controls.TextBlock() { Text = "Popup child", }, }; grid.Children.Add(popup); windowsXamlHost.Child = stackPanel; popup.IsOpen = true; }
public void Show(object content, Style gridStyle, Action callback = null) { _closedCallback = callback; RunSafe(() => { _child = new Grid { Width = Window.Current.Bounds.Width, Height = Window.Current.Bounds.Height, Style = gridStyle, }; _presenter = new ContentPresenter { Width = Window.Current.Bounds.Width, Height = Window.Current.Bounds.Height, ContentTemplate = Template, Content = content, }; SetupPlacement(_presenter); if (TransitionCollection != null) { _presenter.ContentTransitions = TransitionCollection; } (_child as Grid).Children.Add(_presenter); var _focus = new TextBox { Name = "Hidden_Focus_Grabbing_TextBox", RenderTransform = new ScaleTransform { ScaleX = .01, ScaleY = .01 }, PreventKeyboardDisplayOnProgrammaticFocus = true, HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, AllowFocusWhenDisabled = true, Opacity = .001d, IsEnabled = false, IsTabStop = false, Height = 1d, Width = 1d, }; (_child as Grid).Children.Add(_focus); var close = new Button { Content = new SymbolIcon { Symbol = Symbol.Cancel }, VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(16), Padding = new Thickness(16), Visibility = CloseButtonVisibility, RequestedTheme = ElementTheme.Dark, }; close.Click += (s, e) => Hide(); (_child as Grid).Children.Add(close); _popup = new Windows.UI.Xaml.Controls.Primitives.Popup { Child = _child, }; _popup.Opened += (s, e) => { _focus.LosingFocus += (s1, e1) => e1.Handled = true; _focus.Focus(FocusState.Programmatic); }; Window.Current.SizeChanged += Resize; _popup.IsOpen = IsShowing = true; }); }