private void window_Loaded(object sender, RoutedEventArgs e) { Rect r = WindowLocator.GetWorkingAreaOf(this); _maxSize = r.Size; _maxSizeInitialized = true; MaxWidth = _maxSize.Width / 2; MaxHeight = _maxSize.Height * 2 / 3; }
private void buttonSearchSchema_Click(object sender, RoutedEventArgs e) { SearchDataGridWindow win = new SearchDataGridWindow(); FrameworkElement elem = sender as FrameworkElement ?? dataGridColumns; WindowLocator.LocateNearby(elem, win, NearbyLocation.UpLeft); win.Owner = Window.GetWindow(this); win.Target = dataGridColumns; win.Show(); }
private void window_LayoutUpdated(object sender, EventArgs e) { if (_maxSizeInitialized && SizeToContent != SizeToContent.Manual) { SizeToContent = SizeToContent.Manual; Rect r = WindowLocator.GetWorkingAreaOf(this); MaxWidth = r.Width; MaxHeight = r.Height; } }
//private void UpdateButtonAddJoinContextMenu() //{ // Dictionary<JoinTable, List<ForeignKeyConstraint>> dict = new Dictionary<JoinTable, List<ForeignKeyConstraint>>(); // foreach (JoinTable join in JoinTables) // { // Table tbl = join.Table as Table; // if (tbl == null) // { // continue; // } // List<ForeignKeyConstraint> l = new List<ForeignKeyConstraint>(tbl.ReferTo); // dict.Add(join, l); // } // foreach (JoinTable join in JoinTables) // { // if (join.Referrer == null) // { // continue; // } // List<ForeignKeyConstraint> l; // if (dict.TryGetValue(join.Referrer, out l)) // { // l.Remove(join.JoinBy); // } // } // buttonAddJoinContextMenu.Items.Clear(); //} private void buttonFilterColumns_Click(object sender, RoutedEventArgs e) { SelectColumnWindow w = GetColumnFilterWindow(); if (w.IsVisible) { return; } w.Grid = dataGridResult; w.SelectedColumn = w.Grid.CurrentColumn; WindowLocator.LocateNearby(buttonFilterColumns, w, NearbyLocation.DownLeft); w.Closed += ColumnFilterWindow_Closed; w.Show(); }
private void ButtonJoinTableColumns_Click(object sender, RoutedEventArgs e) { //ListBoxItem item = App.FindLogicalParent<ListBoxItem>(sender as DependencyObject); ListBoxItem item = App.FindVisualParent <ListBoxItem>(sender as DependencyObject); JoinTable tbl = item?.DataContext as JoinTable; if (tbl == null) { return; } ColumnCheckListWindow win = new ColumnCheckListWindow(); win.Owner = Window.GetWindow(this); win.Target = tbl; WindowLocator.LocateNearby(sender as FrameworkElement, win, NearbyLocation.DownLeft); win.Closed += ColumnCheckListWindow_Closed; win.Show(); }
private void buttonTitleColor_Click(object sender, RoutedEventArgs e) { ColorPickerWindow win = new ColorPickerWindow(); WindowLocator.LocateNearby(sender as Button, win, NearbyLocation.DownLeft); RGB rgb = Target.BackgroundColor; win.Color = Color.FromRgb(rgb.R, rgb.G, rgb.B); win.Owner = this; bool?ret = win.ShowDialog(); if (ret.HasValue && ret.Value) { rgb = new RGB(win.Color.R, win.Color.G, win.Color.B); Target.BackgroundColor = rgb; UpdateTitleColor(); } }
public static void ShowNearby(Window window, FrameworkElement element, NearbyLocation location) { WindowLocator.LocateNearby(element, window, location); window.Show(); }