本文整理汇总了C#中Windows.UI.Xaml.Controls.Primitives.Popup类的典型用法代码示例。如果您正苦于以下问题:C# Popup类的具体用法?C# Popup怎么用?C# Popup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Popup类属于Windows.UI.Xaml.Controls.Primitives命名空间,在下文中一共展示了Popup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnApplyTemplate
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
var deleteButton = GetTemplateChild("DeleteButton") as Button;
if (deleteButton != null)
deleteButton.Tapped += DeleteButton_Tapped;
if (DateComponents != null)
{
var monthColumn = GetTemplateChild("PART_DateColumn" + Array.IndexOf(DateComponents, month)) as ColumnDefinition;
if (monthColumn != null)
monthColumn.Width = new GridLength(1, GridUnitType.Star);
}
popup = GetTemplateChild("Popup") as Popup;
if (popup != null)
popup.Closed += (_, __) => Focus(FocusState.Programmatic);
VisualStateManager.GoToState(this, "Normal", false);
VisualStateManager.GoToState(this, "NoDate", true);
VisualStateManager.GoToState(this, "NoTime", true);
VisualStateManager.GoToState(this, "NoOffset", true);
VisualStateManager.GoToState(this, "NoAMPM", true);
}
示例2: BlankPage_CommandsRequested
void BlankPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
// 新建一个命令
SettingsCommand cmd = new SettingsCommand("login", "登录", (x) =>
{
// 新建一个Popup,并将其宽度设置为346,高度与屏幕一致
_settingsPopup = new Popup();
_settingsPopup.Width = 346;
_settingsPopup.Height = Window.Current.Bounds.Height;
_settingsPopup.IsLightDismissEnabled = true;
// 新建一个页面,并设置该页面的相关属性(大小,位置)
LoginPane mypane = new LoginPane();
mypane.Height = Window.Current.Bounds.Height;
mypane.Width = 346;
_settingsPopup.Child = mypane;
_settingsPopup.SetValue(Canvas.LeftProperty, Window.Current.Bounds.Width - 346);
_settingsPopup.IsOpen = true;
});
args.Request.ApplicationCommands.Add(cmd);
SettingsCommand cmd1 = new SettingsCommand("logout", "注销", (x) =>
{
});
args.Request.ApplicationCommands.Add(cmd1);
}
示例3: ShowDialog
/// <summary>
/// Displays the dialog.
/// </summary>
public ConfiguredEndpoint ShowDialog(ApplicationConfiguration configuration, bool createNew)
{
m_configuration = configuration;
m_endpoint = null;
// create a default collection if none provided.
if (createNew)
{
ApplicationDescription server = new DiscoveredServerListDlg().ShowDialog(null, m_configuration);
if (server != null)
{
return new ConfiguredEndpoint(server, EndpointConfiguration.Create(configuration));
}
return null;
}
ServersCTRL.Initialize(null, configuration);
OkBTN.IsEnabled = false;
Popup myPopup = new Popup();
myPopup.Child = this;
myPopup.IsOpen = true;
return m_endpoint;
}
示例4: OpenLoginPopUp
private void OpenLoginPopUp(bool open)
{
if (!open)
{
if (loginPopUp != null)
loginPopUp.IsOpen = false;
return;
}
var windowBounds = Window.Current.Bounds;
loginPopUp = new Popup()
{
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
Width = 500,
Height = 310,
IsLightDismissEnabled = false,
IsOpen = true
};
loginPopUp.Child = new LoginView();
loginPopUp.SetValue(Popup.HorizontalOffsetProperty, 600);
loginPopUp.SetValue(Popup.VerticalOffsetProperty, 300);
loginPopUp.Closed += _loginPopup_Closed;
}
示例5: AlphabetSoundGridView_ItemClick
private void AlphabetSoundGridView_ItemClick(object sender, ItemClickEventArgs e)
{
var sound = (Sound)e.ClickedItem;
MyMediaElement.Source = new Uri(this.BaseUri, sound.AudioFile); //playing the sound
// var dialog = new MessageDialog(sound.AudioFile.ToString());
String lett = sound.Name.ToString();
//String lett = sound.AudioFile.ToString().Substring(0,sound.a)
//await dialog2.ShowAsync();
//var user = myTextBox.ToString();
Popup popup = new Popup();
popup.MaxHeight = 2000;
popup.MaxWidth = 2000;
//popup.VerticalOffset = 100;
PopUpPage control = new PopUpPage(lett);
popup.Child = control;
popup.IsOpen = true;
}
示例6: MoviePlayer
public MoviePlayer(ref Popup Popup)
{
this.popup = Popup;
this.InitializeComponent();
string youTubeId = "VXPoJAyeF8k";
TestImage.Source = image;
TestImage.Height = 500;
TestImage.Width = 340;
var url = YouTube.GetVideoUriAsync(youTubeId);
var url2 = YouTube.GetVideoUri(youTubeId, YouTubeQuality.Quality1080P, null);
MovieContainer.Source = url.Result.Uri;
MovieContainer.Play();
MovieContainer.Width = baseMovieWidth;
MovieContainer.Height = baseMovieHeight;
LikeActive = new SolidColorBrush();
LikeActive.Color = Colors.ForestGreen;
LikeInactive = new SolidColorBrush();
LikeInactive.Color = Colors.White;
DislikeActive = new SolidColorBrush();
DislikeActive.Color = Colors.Red;
DislikeInactive = new SolidColorBrush();
DislikeInactive.Color = Colors.White;
}
示例7: AddAlbumAsync
public static async Task<AddAlbumResult> AddAlbumAsync()
{
var tcs = new TaskCompletionSource<int>();
var result = new AddAlbumResult();
var p = new Popup
{
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch,
Width = Window.Current.Bounds.Width,
Height = Window.Current.Bounds.Height
};
var f = new AddAlbumView
{
Width = Window.Current.Bounds.Width,
Height = Window.Current.Bounds.Height,
Cancelled = () =>
{
tcs.TrySetResult(1);
p.IsOpen = false;
},
Result = a =>
{
result = new AddAlbumResult { AlbumName = a };
p.IsOpen = false;
tcs.TrySetResult(1);
}
};
p.Child = f;
p.IsOpen = true;
await tcs.Task;
return result;
}
示例8: Initialize
/// <summary>
/// Initialize VideoPlayer.
/// </summary>
private static void Initialize(VideoStretch stretch)
{
#if NETFX_CORE
if (_videoPopup == null)
{
_videoPopup = new Popup();
}
_videoPopup.VerticalOffset = 0;
_videoPopup.HorizontalOffset = 0;
if (_videoElement == null)
{
_videoElement = new MediaElement();
}
_videoPopup.Child = _videoElement;
_videoElement.MediaEnded += _videoElement_MediaEnded;
_videoElement.MediaOpened += _videoElement_MediaOpened;
_videoPopup.Height = Window.Current.Bounds.Height;
_videoPopup.Width = Window.Current.Bounds.Width;
_videoElement.Tapped += _videoElement_Tapped;
_videoElement.Stretch = (Stretch)stretch;
_videoElement.AutoPlay = false;
_videoElement.Height = _videoPopup.Height;
_videoElement.Width = _videoPopup.Width;
_videoPopup.IsOpen = true;
#endif
}
示例9: OnAboutCommand
private void OnAboutCommand(IUICommand command)
{
SettingsPopup = new Popup();
SettingsPopup.IsLightDismissEnabled = true;
SettingsPopup.Width = SettingsWidth;
SettingsPopup.Height = WindowBounds.Height;
SettingsPopup.ChildTransitions = new TransitionCollection
{
new PaneThemeTransition
{
Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right)
? EdgeTransitionLocation.Right
: EdgeTransitionLocation.Left
}
};
var mypane = new AboutFlyout { Width = SettingsWidth, Height = WindowBounds.Height };
SettingsPopup.Child = mypane;
SettingsPopup.SetValue(Canvas.LeftProperty,
SettingsPane.Edge == SettingsEdgeLocation.Right
? (WindowBounds.Width - SettingsWidth)
: 0);
SettingsPopup.SetValue(Canvas.TopProperty, 0);
SettingsPopup.IsOpen = true;
}
示例10: ShowInPopup
public void ShowInPopup(double? width = null, double? height = null)
{
var popup = new Popup();
if (width.HasValue)
{
popup.Width = width.Value;
this.Width = width.Value;
}
if (height.HasValue)
{
popup.Height = height.Value;
this.Height = height.Value;
}
this._parentPopup = popup;
popup.Child = this;
popup.IsOpen = true;
_currentlyShownInstances.Add(this);
this.PrepareForLoad();
}
示例11: OnWrapOptionsAppBarButtonClick
void OnWrapOptionsAppBarButtonClick(object sender, RoutedEventArgs args)
{
// Create dialog
WrapOptionsDialog wrapOptionsDialog = new WrapOptionsDialog
{
TextWrapping = txtbox.TextWrapping
};
// Bind dialog to TextBox
Binding binding = new Binding
{
Source = wrapOptionsDialog,
Path = new PropertyPath("TextWrapping"),
Mode = BindingMode.TwoWay
};
txtbox.SetBinding(TextBox.TextWrappingProperty, binding);
// Create popup
Popup popup = new Popup
{
Child = wrapOptionsDialog,
IsLightDismissEnabled = true
};
// Adjust location based on content size
wrapOptionsDialog.SizeChanged += (dialogSender, dialogArgs) =>
{
popup.VerticalOffset = this.ActualHeight - wrapOptionsDialog.ActualHeight
- this.BottomAppBar.ActualHeight - 48;
popup.HorizontalOffset = 48;
};
// Open the popup
popup.IsOpen = true;
}
示例12: ShowAsync
public static async Task ShowAsync(this IDialog view)
{
var tcs = new TaskCompletionSource<int>();
var p = new Popup
{
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch,
Width = Window.Current.Bounds.Width,
Height = Window.Current.Bounds.Height
};
((UserControl)view).Width = Window.Current.Bounds.Width;
((UserControl)view).Height = Window.Current.Bounds.Height;
view.Cancelled += () =>
{
tcs.TrySetResult(1);
p.IsOpen = false;
};
p.Child = (UserControl)view;
p.IsOpen = true;
await tcs.Task;
return;
}
示例13: OnSettingsCommandInvoker
private void OnSettingsCommandInvoker(IUICommand command)
{
settingsPopup = new Popup();
settingsPopup.Closed += SettingsPopupOnClosed;
Window.Current.Activated += OnWindowActivated;
settingsPopup.IsLightDismissEnabled = true;
settingsPopup.Width = settingsWidth;
settingsPopup.Height = windowBounds.Height;
settingsPopup.ChildTransitions = new TransitionCollection();
settingsPopup.ChildTransitions.Add(new PaneThemeTransition()
{
Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ?
EdgeTransitionLocation.Right :
EdgeTransitionLocation.Left
});
// Create a SettingsFlyout the same dimenssions as the Popup.
var mypane = new SettingsFlyoutPage
{
DataContext = this.Settings
};
mypane.Width = settingsWidth;
mypane.Height = windowBounds.Height;
settingsPopup.Child = mypane;
settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (windowBounds.Width - settingsWidth) : 0);
settingsPopup.SetValue(Canvas.TopProperty, 0);
settingsPopup.IsOpen = true;
}
示例14: OnPopupClosed
private void OnPopupClosed(object sender, object e)
{
if (_tcs != null && !_tcs.Task.IsCompleted)
_tcs.SetException(new OperationCanceledException()); // user closed the window
_tcs = null;
_popup = null;
}
示例15: VerMetodoPagoPopup
public VerMetodoPagoPopup(Popup padre)
{
if (padre == null) throw new ArgumentNullException("Debe asignar un Popup al controlador");
this.popup = padre;
this.InitializeComponent();
cargarMetodoPago();
}