public void AddTitleColumn(Object key, Object obj, double width) { Grid grid = new Grid(); grid.Height = 15; grid.Width = width; AddToTitle(obj, width); UIElement element = WpfFinder.getUiElement(obj); element.SetValue(VerticalAlignmentProperty, VerticalAlignment.Center); element.SetValue(HorizontalAlignmentProperty, HorizontalAlignment.Center); grid.Children.Add(element); Rectangle rect = new Rectangle(); rect.Style = this.FindResource("SeperatorLine") as Style; rect.Margin = new Thickness(width - 3, 3, 0, 3); rect.Width = 1; rect.Height = 15; rect.VerticalAlignment = System.Windows.VerticalAlignment.Center; grid.Children.Add(rect); _titles.Add(obj); _titleDic.Add(key, element); //_wid.Add(width); }
void AddToTitle(Object obj, double wid, Boolean editable) { UIElement item = WpfFinder.getUiElement(obj); if (item is CheckBox) { CheckBox box = getStyledCheckBox(((item as CheckBox).IsChecked)); item = box; box.Checked += new RoutedEventHandler(Header_Checked); box.Unchecked += new RoutedEventHandler(Header_Checked); } Header.addAnItem(true, item, wid); Header.ColName = _titleDic.Keys.ToList(); _wid.Add(wid); _editables.Add(editable); NotifyPropertyChanged("Header"); }
public void AddValue(params object[] values) { if (values == null || values.Length == 0) { return; } if (values != null && values[0] is object[]) { values = values[0] as object[]; } List <UIElement> elList = new List <UIElement>(); UIElement element; for (int i = 0; i < values.Length; i++) { element = WpfFinder.getUiElement(values[i]); elList.Add(element); } ListRow row = new ListRow(_wid, 20, true, elList); _rows.Add(row); DataList.Items.Add(row); }
public void ReleaseSelection() { //try { foreach (ListRow row in Rows) { row.Selected = false; } IsSelected = false; _selectedItems.Clear(); UIElement aChild = null; if (Rows.Count > 0 && Rows[0].Count > 0) { aChild = Rows[0][0] as UIElement; } if (aChild == null) { return; } ListBoxItem item = WpfFinder.getParentFromTemplate(aChild, DependencyObjectType.FromSystemType(typeof(ListBoxItem))) as ListBoxItem; if (item == null) { return; } item.IsSelected = false; ListBox view = LogicalTreeHelper.GetParent(item) as ListBox; DependencyObject obj = VisualTreeHelper.GetParent(item); while (obj != null) { if (obj is ListBox || obj is ListView) { view = obj as ListView; break; } obj = VisualTreeHelper.GetParent(obj); } if (view == null) { return; } //DataTemplate template = this.ContentTemplateSelector.SelectTemplate(this, this); view.SelectionMode = System.Windows.Controls.SelectionMode.Single; view.SelectionMode = System.Windows.Controls.SelectionMode.Extended; view.SelectedItem = null; view.SelectedItems.Clear(); view.SelectedIndex = -1; view.SelectedValue = null; foreach (ListRow row in view.Items) { row.Selected = false; } IsSelected = false; } //catch(Exception e) { // throw e; //} }
void AddDataRowInvoke() { //if (lv == null) { // return; } //else { double height = ad_height; object relativeObj = ad_relativeObj; object[] values = ad_values; List <UIElement> elList = new List <UIElement>(); UIElement element; //try { for (int i = 0; i < values.Length; i++) { element = (values[i] is UIElement) ? values[i] as UIElement : WpfFinder.getUiElement(values[i]); if (element is CheckBox) { element = getStyledCheckBox(((element as CheckBox).IsChecked)); } else if (element is TextBlock) { (element as TextBlock).ToolTip = (element as TextBlock).Text; element.SetValue(FontFamilyProperty, this.FontFamily); element.SetValue(FontSizeProperty, this.FontSize); element.SetValue(ForegroundProperty, this.Foreground); } else if (element is Image) { } elList.Add(element); /* * if (element is CheckBox) * { * (element as CheckBox).Checked += new RoutedEventHandler(OnCheckBoxClicked); * (element as CheckBox).Unchecked += new RoutedEventHandler(OnCheckBoxClicked); * } */ } ListRow row = new ListRow(_wid, RowHeight, true, elList); row.ColName = Header.ColName; row.RelativeObject = relativeObj; row.ItemHorizontalAlignment = DataHorizonAlignment; row.Index = Rows.Count; row.E_TextChanged += new ListRowTextChangedEventHandler(row_E_TextChanged); row.E_CheckBoxChanged += new ListCheckedEventHandler(OnCheckBoxClicked); row.E_ComboBoxChanged += new ListComboBoxEventHandler(row_E_ComboBoxChanged); row.Editables = _editables; _tempNewList.Add(row); // if(_listView!=null) // _listView.Items.Add(row); } //catch (Exception e) { //throw e; } //NotifyPropertyChanged("Rows"); } }
void AddToTitle(Object obj, double wid) { Header.addAnItem(true, WpfFinder.getUiElement(obj), wid); _wid.Add(wid); }