本文整理汇总了C#中MahApps.Metro.Controls.Flyout类的典型用法代码示例。如果您正苦于以下问题:C# Flyout类的具体用法?C# Flyout怎么用?C# Flyout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Flyout类属于MahApps.Metro.Controls命名空间,在下文中一共展示了Flyout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetectTheme
private static Tuple<Theme, Accent> DetectTheme(Flyout flyout)
{
if (flyout == null)
return null;
// first look for owner
var window = flyout.TryFindParent<MetroWindow>();
var theme = window != null ? ThemeManager.DetectTheme(window) : null;
if (theme != null && theme.Item2 != null)
return theme;
// second try, look for main window
if (Application.Current != null) {
var mainWindow = Application.Current.MainWindow as MetroWindow;
theme = mainWindow != null ? ThemeManager.DetectTheme(mainWindow) : null;
if (theme != null && theme.Item2 != null)
return theme;
// oh no, now look at application resource
theme = ThemeManager.DetectTheme(Application.Current);
if (theme != null && theme.Item2 != null)
return theme;
}
return null;
}
示例2: DetachHandlers
private void DetachHandlers(Flyout item)
{
var isOpenChanged = DependencyPropertyDescriptor.FromProperty(Flyout.IsOpenProperty, typeof(Flyout));
var themeChanged = DependencyPropertyDescriptor.FromProperty(Flyout.ThemeProperty, typeof(Flyout));
isOpenChanged.RemoveValueChanged(item, this.FlyoutStatusChanged);
themeChanged.RemoveValueChanged(item, this.FlyoutStatusChanged);
}
示例3: InitWindow
/// <summary>
/// Initializes the control with a <see cref="MainWindow"/>. Necessary, as the <see cref="Window.GetWindow"/> method is unable to find a window for flyout controls.
/// </summary>
/// <param name="mainWindow">The <see cref="MainWindow"/>.</param>
public void InitWindow( MainWindow mainWindow )
{
this.window = mainWindow;
flyout = window.OSFlyout;
flyout.IsOpenChanged += OsFlyoutOnIsOpenChanged;
downloader = new WebClient( );
downloader.DownloadProgressChanged += ( Sender, Args ) => controller.SetProgress( Args.BytesReceived );;
downloader.DownloadFileCompleted += DownloaderOnDownloadFileCompleted;
LanguageList.SelectionChanged += ( Sender, Args ) =>
{
bool HasSelection = LanguageList.SelectedItems.Count > 0;
DownloadSubsLanguagesButton.IsEnabled = HasSelection;
};
window.SizeChanged += ( Sender, Args ) =>
{
if ( !Args.WidthChanged )
return;
this.Width = Args.NewSize.Width * 0.8;
};
}
示例4: FlyoutInfo
public FlyoutInfo(Flyout flyout, object content)
{
Argument.IsNotNull(() => flyout);
Argument.IsNotNull(() => content);
Flyout = flyout;
Content = content;
}
示例5: AboutActions
public AboutActions()
{
InitializeComponent();
Loaded += (sender, args) =>
{
NotifyOnInternalButtonClick();
parent = this.GetParentObject() as Flyout;
};
}
示例6: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.TaskSetup = ((MahApps.Metro.Controls.Flyout)(target));
return;
}
this._contentLoaded = true;
}
示例7: HideFlyout
public void HideFlyout(Flyout flyout)
{
var actualType = flyout.GetType();
var openFlyoutDetail = openFlyouts.FirstOrDefault(x => x.FlyoutType == actualType);
if (openFlyoutDetail != null)
openFlyoutDetail.IsHidden = true;
flyout.IsOpen = false;
}
示例8: AddFlyout
public void AddFlyout(string name, Type viewType, Position position, UnloadBehavior unloadBehavior = UnloadBehavior.SaveAndCloseViewModel)
{
Argument.IsNotNullOrWhitespace(() => name);
Argument.IsNotNull(() => viewType);
Log.Info("Adding flyout '{0}' with view type '{1}'", name, viewType.FullName);
var content = (UIElement) _typeFactory.CreateInstance(viewType);
var flyout = new Flyout();
flyout.Theme = FlyoutTheme.Adapt;
flyout.Position = position;
var flyoutInfo = new FlyoutInfo(flyout, content);
flyout.SetBinding(Flyout.HeaderProperty, new Binding("ViewModel.Title") {Source = content});
((ICompositeCommand) _commandManager.GetCommand("Close")).RegisterAction(() => { flyout.IsOpen = false; });
flyout.IsOpenChanged += async (sender, e) =>
{
if (!flyout.IsOpen)
{
var vmContainer = flyout.Content as IViewModelContainer;
if (vmContainer != null)
{
var vm = vmContainer.ViewModel;
if (vm != null)
{
switch (unloadBehavior)
{
case UnloadBehavior.CloseViewModel:
await vm.CloseViewModelAsync(null);
break;
case UnloadBehavior.SaveAndCloseViewModel:
await vm.SaveAndCloseViewModelAsync();
break;
case UnloadBehavior.CancelAndCloseViewModel:
await vm.CancelAndCloseViewModelAsync();
break;
default:
throw new ArgumentOutOfRangeException("unloadBehavior");
}
}
}
flyout.Content = null;
flyout.DataContext = null;
}
};
_flyouts[name] = flyoutInfo;
}
示例9: AttachHandlers
private void AttachHandlers(Flyout flyout)
{
var isOpenNotifier = new PropertyChangeNotifier(flyout, Flyout.IsOpenProperty);
isOpenNotifier.ValueChanged += FlyoutStatusChanged;
flyout.IsOpenPropertyChangeNotifier = isOpenNotifier;
var themeNotifier = new PropertyChangeNotifier(flyout, Flyout.ThemeProperty);
themeNotifier.ValueChanged += FlyoutStatusChanged;
flyout.ThemePropertyChangeNotifier = themeNotifier;
}
示例10: UnregisterFlyout
public void UnregisterFlyout(Flyout flyout)
{
var mainWindow = Application.Current.MainWindow as MetroWindow;
if (mainWindow != null)
{
flyout.Loaded -= IsOpenBeforeLoadedWorkaround;
mainWindow.Flyouts.Remove(flyout);
}
}
示例11: HandleFlyoutStatusChange
internal void HandleFlyoutStatusChange(Flyout flyout, MetroWindow parentWindow)
{
if (flyout == null || parentWindow == null)
{
return;
}
this.ReorderZIndices(flyout);
var visibleFlyouts = this.GetFlyouts(this.Items).Where(i => i.IsOpen).OrderBy(Panel.GetZIndex);
parentWindow.HandleFlyoutStatusChange(flyout, visibleFlyouts);
}
示例12: CloseFlyout
public void CloseFlyout(Flyout flyout)
{
var actualType = flyout.GetType();
var openFlyoutDetail = openFlyouts.FirstOrDefault(x => x.FlyoutType == actualType);
if (openFlyoutDetail != null)
{
openFlyoutDetail.IsHidden = false;
}
flyout.IsOpen = false;
FlyoutClosedHandler(flyout, null);
}
示例13: MainWindow_Loaded
void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
_dataContext.ShowDefaultCharts();
Flyouts = new FlyoutsControl();
Flyout control = new Flyout();
_lineEditorView = new ucLineEditorView(Token);
_lineEditorView.DataContext = new LineEditorViewModel(Token);
GlobalDataModel.LineEditorViewModel = _lineEditorView.DataContext as LineEditorViewModel;
control.Content = _lineEditorView;
control.Position = Position.Right;
control.Width = 195;
control.IsOpenChanged += control_IsOpenChanged;
Flyouts.Items.Add(control);
}
示例14: AdaptsWindowCommandsToDarkFlyout
public async Task AdaptsWindowCommandsToDarkFlyout()
{
await TestHost.SwitchToAppThread();
var window = await WindowHelpers.CreateInvisibleWindowAsync<FlyoutWindow>();
var flyout = new Flyout { Theme = FlyoutTheme.Dark };
window.Flyouts.Items.Add(flyout);
flyout.IsOpen = true;
Color expectedColor = ((SolidColorBrush)ThemeManager.GetAppTheme("BaseDark").Resources["BlackBrush"]).Color;
window.AssertWindowCommandsColor(expectedColor);
}
示例15: SetSettingsFlyoutControl
public void SetSettingsFlyoutControl()
{
var window = Hearthstone_Deck_Tracker.API.Core.MainWindow;
var flyouts = window.Flyouts.Items;
Flyout flyout = new Flyout();
flyout.Name = "PluginSettingsFlyoutControl";
flyout.Header = "Video Game Recorder";
flyout.Content = new SettingsControl();
flyout.Position = Position.Left;
Panel.SetZIndex(flyout, 100);
flyouts.Add(flyout);
_settingsFlyout = flyout;
}