public Group() { InitializeComponent(); m_custGrpStyle = (GroupStyle)FindResource("customGrpStyle"); m_ageRange = new AgeRanger(); }
private void InitializeList() { var view = new GridView(); view.Columns.Add(new GridViewColumn() { Header = "Path", DisplayMemberBinding = new Binding("Path") }); listBox.View = view; var viewSource = CollectionViewSource.GetDefaultView(Files); viewSource.GroupDescriptions.Add(new PropertyGroupDescription("Sha")); var groupStyle = new GroupStyle(); var headerTemplate = new DataTemplate(); var frameworkElementFactory = new FrameworkElementFactory(typeof(TextBlock)); frameworkElementFactory.SetValue(TextBlock.ForegroundProperty, Brushes.Gray); frameworkElementFactory.SetValue(TextBlock.TextProperty, new Binding("Name")); headerTemplate.VisualTree = frameworkElementFactory; groupStyle.HeaderTemplate = headerTemplate; listBox.GroupStyle.Add(groupStyle); listBox.ItemsSource = viewSource; }
private void btnAddGrouping_Click(object sender, RoutedEventArgs e) { ICollectionView view = CollectionViewSource.GetDefaultView(MyDataGrid.ItemsSource); if (view == null) { return; } if (view.GroupDescriptions.Count == 0) { view.GroupDescriptions.Add(new PropertyGroupDescription("Department")); } else if (view.GroupDescriptions.Count == 1) { view.GroupDescriptions.Add(new PropertyGroupDescription("Gender")); } if (MyDataGrid.GroupStyle == null || MyDataGrid.GroupStyle.Count == 0) { GroupStyle groupStyle = TryFindResource("GroupHeaderStyle") as GroupStyle; MyDataGrid.GroupStyle.Add(groupStyle); } MyDataGrid.UpdateLayout(); ScrollToSelection(); MyDataGrid.Focus(); }
private void SetupListView(object data) { var grid = new GridView(); if (data is IList <Recipe> ) { grid.ItemsSource = data; } else { var cvs = new CollectionViewSource(); cvs.Source = data; cvs.IsSourceGrouped = true; cvs.ItemsPath = new PropertyPath("Recipes"); grid.ItemsSource = cvs.View; var groupStyle = new GroupStyle(); grid.GroupStyle.Add(groupStyle); } grid.ShowsScrollingPlaceholders = false; grid.ItemTemplate = (DataTemplate)Resources["GridViewItemTemplatePhased"]; grid.ItemContainerTransitions = new TransitionCollection(); grid.ItemsPanel = (ItemsPanelTemplate)XamlReader.Load("<ItemsPanelTemplate xmlns='http://schemas.microsoft.com/client/2007'><ItemsWrapGrid Orientation='Horizontal' CacheLength='4'/></ItemsPanelTemplate>"); host.Child = grid; _printChildrenCount = () => grid.ItemsPanelRoot.Children.Count.ToString(); }
public ViewPatientAnalysisMeasurements() { InitializeComponent(); _roiLayerNameGroupStyle = new GroupStyle() { ContainerStyle = (Style)this.FindResource("RoiLayerNameGroupStyle") }; }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (!CanSelectGroup) { lsvDetectItem.GroupStyle.Clear(); GroupStyle groupStyle = (GroupStyle)this.Resources["groupStyle"]; lsvDetectItem.GroupStyle.Add(groupStyle); } }
public LogRecordsTableView() { InitializeComponent(); _defaultGroupStyle = (GroupStyle)FindResource("groupStyle"); InitDataGrid(); Loaded += LogRecordsTableView_Loaded; }
public static TItemsControl GroupStyle <TItemsControl>(this TItemsControl @this, DataTemplate headerTemplate) where TItemsControl : ItemsControl { var groupStyle = new GroupStyle { HeaderTemplate = headerTemplate }; @this.GroupStyle.Add(groupStyle); return(@this); }
/// <summary> /// /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); PART_Border = Template.FindName("PART_Border", this) as Border; PART_Splitter = Template.FindName("PART_Splitter", this) as GridSplitter; NameColumn.CellTemplate = (DataTemplate)PART_Border.Resources["DataTemplate.Property.Name"]; ValueColumn.CellTemplate = (DataTemplate)PART_Border.Resources["DataTemplate.Property.Value"]; GroupStyle.Add((GroupStyle)PART_Border.Resources["Style.Group"]); }
protected override void OnInitialized() { InputType = InputType.OrDefault(GetInputType()); Id = string.IsNullOrWhiteSpace(Id) ? Guid.NewGuid().ToString().Substring(0, 10) : Id; Name = string.IsNullOrWhiteSpace(Name) ? Id : Name; GroupClass = GroupClass.OrDefault(Class).OrDefault("form-group"); InputClass = InputClass.OrDefault(Class).OrDefault("form-control"); LabelClass = LabelClass.OrDefault(Class); GroupStyle = GroupStyle.OrDefault(Style); InputStyle = InputStyle.OrDefault(Style); LabelStyle = LabelStyle.OrDefault(Style); }
public ViewPatientOverview() { _touchDevicesPoints = new Dictionary <TouchDevice, Point>(); _touchZoomDistance = 0; InitializeComponent(); _dateGroupStyle = new GroupStyle() { ContainerStyle = (Style)this.FindResource("DateGroupStyle") }; _typeGroupStyle = new GroupStyle() { ContainerStyle = (Style)this.FindResource("TypeGroupStyle") }; }
private static VectorStyle CreateStyle(StyleElement[] styles, string type) { if (styles.Length == 1) { VectorStyle vs = new VectorStyle(); vs.Symbol = null; vs.Fill = null; vs.Line = null; if (string.Compare(type, "point", StringComparison.InvariantCultureIgnoreCase) == 0) { Brush b = new SolidBrush(styles[0].Color); vs.PointColor = b; vs.PointSize = (float)styles[0].Size; if (styles[0].Offset != Point.Empty) { vs.SymbolOffset = new PointF(styles[0].Offset.X, styles[0].Offset.Y); } } else if (string.Compare(type, "line", StringComparison.InvariantCultureIgnoreCase) == 0) { vs.Line = new Pen(styles[0].Color, (float)styles[0].Width); if (styles[0].Offset != Point.Empty) { vs.LineOffset = styles[0].Offset.Y; } } else if (string.Compare(type, "polygon", StringComparison.InvariantCultureIgnoreCase) == 0) { Brush b = new SolidBrush(styles[0].Color); vs.Fill = b; } if (styles[0].OutlineColor != Color.Empty) { vs.EnableOutline = true; vs.Outline = new Pen(styles[0].OutlineColor); } return(vs); } else { GroupStyle gs = new GroupStyle(); for (int i = 0; i < styles.Length; i++) { gs.AddStyle(CreateStyle(new [] { styles[i] }, type)); } return(gs); } }
protected override void OnTemplateChanged(ControlTemplate oldTemplate, ControlTemplate newTemplate) { base.OnTemplateChanged(oldTemplate, newTemplate); //Check if this template specifies a GroupStyle (which can't be done in Xaml directly) if (newTemplate != null) { GroupStyle groupStyle = newTemplate.Resources["PART_GroupStyle"] as GroupStyle; if (groupStyle != null) { GroupStyle.Clear(); GroupStyle.Add(groupStyle); } } }
private void GroupByProperty(PropertyGroupDescription groupOption, GroupStyle grpStyle) { PersonCollection persons = (PersonCollection)FindResource("persons"); ICollectionView view = CollectionViewSource.GetDefaultView(persons); if (view.GroupDescriptions.Count == 0) { view.GroupDescriptions.Add(groupOption); lbxPersons.GroupStyle.Add(grpStyle); } else { view.GroupDescriptions.Clear(); lbxPersons.GroupStyle.Clear(); } }
public MainWindow() { InitializeComponent(); DataContext = this; ComboBox comboBox1 = new ComboBox(); comboBox1.Height = 23; comboBox1.Width = 200; GroupStyle style = new GroupStyle(); style.HeaderTemplate = (DataTemplate)this.FindResource("groupStyle"); comboBox1.GroupStyle.Add(style); comboBox1.DisplayMemberPath = "Item"; ObservableCollection <CategoryItem <string> > items = new ObservableCollection <CategoryItem <string> >(); items.Add(new CategoryItem <string> { Category = "Warm Colors", Item = "Orange" }); items.Add(new CategoryItem <string> { Category = "Warm Colors", Item = "Red" }); items.Add(new CategoryItem <string> { Category = "Warm Colors", Item = "Pink" }); items.Add(new CategoryItem <string> { Category = "Cool Colors", Item = "Blue" }); items.Add(new CategoryItem <string> { Category = "Cool Colors", Item = "Purple" }); items.Add(new CategoryItem <string> { Category = "Cool Colors", Item = "Green" }); CollectionViewSource cvs = new CollectionViewSource(); cvs.GroupDescriptions.Add(new PropertyGroupDescription("Category")); cvs.Source = items; Binding b = new Binding(); b.Source = cvs; BindingOperations.SetBinding( comboBox1, ComboBox.ItemsSourceProperty, b); myGrid.Children.Add(comboBox1); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); if (DesignerProperties.GetIsInDesignMode(this)) { return; } GroupStyle.Add(new GroupStyle() { ContainerStyle = FindResource("DelightGroupItemStyle") as Style }); // Search bar Binding Binding b = BindingHelper.SetBinding( GetTemplateChild("PART_searchBox"), TextBox.TextProperty, this, FilterKeywordProperty, sourceTrigger: UpdateSourceTrigger.PropertyChanged); }
public override FrameworkElementFactory GenerateField(IFactoryContext context, ComboBoxDescription fieldDescription) { FrameworkElementFactory element; if (context.FormState == FormState.View) { element = CreateReadOnlyTextElement(fieldDescription.SelectedItem, fieldDescription.StringFormat); } else { element = new FrameworkElementFactory(typeof(ComboBox)); element.SetValue(ComboBox.MinWidthProperty, 120d); element.SetValue(ScrollViewer.CanContentScrollProperty, false); element.SetValue(ComboBox.IsReadOnlyProperty, true); //element.SetValue(ComboBox.HorizontalAlignmentProperty, HorizontalAlignment.Stretch); element.SetBinding(TextBlock.ToolTipProperty, new Binding(fieldDescription.SelectedItem)); if (fieldDescription.GroupTemplate != null) { GroupStyle groupStyle = new GroupStyle(); groupStyle.HeaderTemplate = fieldDescription.GroupTemplate; } if (fieldDescription.SelectedItem != null) { element.SetValue(ComboBox.SelectedItemProperty, new Binding(fieldDescription.SelectedItem) { Mode = BindingMode.TwoWay }); } element.SetValue(ComboBox.ItemTemplateProperty, CreateItemTemplate()); if (fieldDescription.ItemsSource != null) { element.SetValue(ComboBox.ItemsSourceProperty, new Binding(fieldDescription.ItemsSource)); } } return(element); }
public MainWindow() { InitializeComponent(); DataContext = this; ComboBox comboBox1 = new ComboBox(); comboBox1.Height = 23; comboBox1.Width = 200; GroupStyle style = new GroupStyle(); style.HeaderTemplate = (DataTemplate)this.FindResource("groupStyle"); comboBox1.GroupStyle.Add(style); comboBox1.DisplayMemberPath = "Item"; List <CategoryItem <string> > items = new List <CategoryItem <string> >(); items.Add(new CategoryItem <string> { Category = "Warm Colors", Item = "Orange" }); items.Add(new CategoryItem <string> { Category = "Warm Colors", Item = "Red" }); items.Add(new CategoryItem <string> { Category = "Warm Colors", Item = "Pink" }); items.Add(new CategoryItem <string> { Category = "Cool Colors", Item = "Blue" }); items.Add(new CategoryItem <string> { Category = "Cool Colors", Item = "Purple" }); items.Add(new CategoryItem <string> { Category = "Cool Colors", Item = "Green" }); //Need the list to be ordered by the category or you might get repeating categories ListCollectionView lcv = new ListCollectionView(items.OrderBy(w => w.Category).ToList()); //Create a group description lcv.GroupDescriptions.Add(new PropertyGroupDescription("Category")); comboBox1.ItemsSource = lcv; myGrid.Children.Add(comboBox1); //myGrid is the name of the parent control }
protected override GroupStyle SelectGroupStyleCore(object group, uint level) { GroupStyle style = Application.Current.Resources["MainPageGroupStyle"] as GroupStyle; var dataItem = group as Windows.UI.Xaml.Data.ICollectionViewGroup; if (dataItem != null) { var obj = dataItem.Group as ChannelRecommendGroup; if (obj != null) { if (obj.GroupName == "频道") { style = Application.Current.Resources["MainPageChannelGroupStyle"] as GroupStyle; } else { style = Application.Current.Resources["MainPageGroupStyle"] as GroupStyle; } } } return(style); }
public void createGroup(string groupName, string desc, string[] members, string reason, int maxUsers, GroupStyle style, EMGroupCallback cb) { AddCallbackToList(cb); sdk.createGroup(cb.CallbackId, groupName, desc, string.Join(",", members), reason, maxUsers, (int)style); }
public static void SetGroupStyle(DependencyObject obj, GroupStyle value) { obj.SetValue(GroupStyleProperty, value); }
public static void SetAppend(DependencyObject d, GroupStyle value) { d.SetValue(AppendProperty, value); }
/// <summary> /// Initializes a new instance of the <see cref="StyleElement"/> class. /// </summary> /// <param name="style">The style.</param> /// <param name="boundType">Type of the bound.</param> /// <param name="name">The name.</param> internal GroupStyleElement(GroupStyle style, BoundType boundType, string name) { this.style = style; type = boundType; this.name = name + " [GroupStyle] "; }
private void AddDataGrid(DataView dv, string strataValue) { DataGrid dg = new DataGrid(); dg.Style = this.Resources["LineListDataGridStyle"] as Style; CombinedFrequencyParameters CombinedFrequencyParameters = (this.Parameters) as CombinedFrequencyParameters; FrameworkElementFactory datagridRowsPresenter = new FrameworkElementFactory(typeof(DataGridRowsPresenter)); ItemsPanelTemplate itemsPanelTemplate = new ItemsPanelTemplate(); itemsPanelTemplate.VisualTree = datagridRowsPresenter; GroupStyle groupStyle = new GroupStyle(); groupStyle.ContainerStyle = this.Resources["DefaultGroupItemStyle"] as Style; groupStyle.Panel = itemsPanelTemplate; dg.GroupStyle.Add(groupStyle); GroupStyle groupStyle2 = new GroupStyle(); groupStyle2.HeaderTemplate = this.Resources["GroupDataTemplate"] as DataTemplate; //groupStyle.Panel = itemsPanelTemplate; dg.GroupStyle.Add(groupStyle2); string groupVar = String.Empty; //if (!String.IsNullOrEmpty(ListParameters.PrimaryGroupField.Trim())) //{ // groupVar = ListParameters.PrimaryGroupField.Trim(); // ListCollectionView lcv = new ListCollectionView(dv); // lcv.GroupDescriptions.Add(new PropertyGroupDescription(groupVar)); // if (!String.IsNullOrEmpty(ListParameters.SecondaryGroupField.Trim()) && !ListParameters.SecondaryGroupField.Trim().Equals(groupVar)) // { // lcv.GroupDescriptions.Add(new PropertyGroupDescription(ListParameters.SecondaryGroupField.Trim())); // for second category // } // dg.ItemsSource = lcv; //} //else //{ dg.ItemsSource = dv; //} if (Parameters.Height.HasValue) { dg.MaxHeight = Parameters.Height.Value; } else { dg.MaxHeight = 700; } if (Parameters.Width.HasValue) { dg.MaxWidth = Parameters.Width.Value; } else { dg.MaxWidth = 900; } dg.AutoGeneratedColumns += new EventHandler(dg_AutoGeneratedColumns); dg.AutoGeneratingColumn += new EventHandler <DataGridAutoGeneratingColumnEventArgs>(dg_AutoGeneratingColumn); panelMain.Children.Add(dg); }
/// <summary> /// Creates a bound group style. /// </summary> /// <param name="groupStyle">The group style.</param> /// <param name="type">The type.</param> /// <param name="name">The name.</param> /// <returns></returns> public static IBoundElement GroupStyle(GroupStyle groupStyle, BoundType type, string name) { return(new GroupStyleElement(groupStyle, type, name)); }
public GroupShape() { _shapes = new List <IShape>(); _outLineStyle = new OutLineGroupStyle(GetOutLineStyleFromAllShapes()); _fillStyle = new GroupStyle <IStyle>(GetBaseStyleFromAllShapes()); }
/// <summary> /// Creates a bound group style. /// </summary> /// <param name="groupStyle">The group style.</param> /// <param name="type">The type.</param> /// <returns></returns> public static IBoundElement GroupStyle(GroupStyle groupStyle, BoundType type) { return(GroupStyle(groupStyle, type, string.Empty)); }
/// <summary> /// Sets the group style attached via the <see cref="P:TomsToolbox.Wpf.StyleBindings.GroupStyle"/> attached property. /// </summary> /// <param name="obj">The object the group style is attached to.</param> /// <param name="value">The group style.</param> public static void SetGroupStyle([NotNull] DependencyObject obj, [CanBeNull] GroupStyle value) { obj.SetValue(GroupStyleProperty, value); }
/// <summary> /// Sets the group style attached via the <see cref="P:TomsToolbox.Wpf.StyleBindings.GroupStyle"/> attached property. /// </summary> /// <param name="obj">The object the group style is attached to.</param> /// <param name="value">The group style.</param> public static void SetGroupStyle([NotNull] DependencyObject obj, [CanBeNull] GroupStyle value) { Contract.Requires(obj != null); obj.SetValue(GroupStyleProperty, value); }
public GroupShape() { _shapes = new List <IShape>(); _fillStyle = new GroupStyle <IStyle>(GetGroupFillStyle()); _outlineStyle = new GroupOutlineStyle(GetGroupOutlineStyle()); }