示例#1
0
文件: CellUtil.cs 项目: m13253/xwt
		internal static FrameworkElementFactory CreateBoundColumnTemplate (ApplicationContext ctx, Widget parent, CellViewCollection views, string dataPath = ".")
		{
			if (views.Count == 1)
                return CreateBoundCellRenderer(ctx, parent, views[0], dataPath);
			
			FrameworkElementFactory container = new FrameworkElementFactory (typeof (StackPanel));
			container.SetValue (StackPanel.OrientationProperty, System.Windows.Controls.Orientation.Horizontal);

			foreach (CellView view in views) {
				var factory = CreateBoundCellRenderer(ctx, parent, view, dataPath);

				factory.SetValue(FrameworkElement.MarginProperty, CellMargins);

				if (view.VisibleField != null)
				{
					var binding = new Binding(dataPath + "[" + view.VisibleField.Index + "]");
					binding.Converter = new BooleanToVisibilityConverter();
					factory.SetBinding(UIElement.VisibilityProperty, binding);
				}
				else if (!view.Visible)
					factory.SetValue(UIElement.VisibilityProperty, Visibility.Collapsed);

				container.AppendChild(factory);
			}

			return container;
		}
示例#2
0
 public void SetViews(CellViewCollection views)
 {
     column.Views.Clear ();
     foreach (var v in views)
         column.Views.Add (v);
     UpdateColumn (column, columnHandle, ListViewColumnChange.Cells);
 }
示例#3
0
 public void SetViews(CellViewCollection views)
 {
     ListBox.DisplayMemberPath = null;
     ListBox.ItemTemplate      = new DataTemplate {
         VisualTree = CellUtil.CreateBoundColumnTemplate(Context, Frontend, views)
     };
 }
示例#4
0
 public void SetViews(CellViewCollection views)
 {
     Widget.Clear();
     foreach (var v in views)
     {
         CellUtil.CreateCellRenderer(ApplicationContext, this, null, v, Widget.Model);
     }
 }
示例#5
0
 public void SetViews(CellViewCollection views)
 {
     Widget.Clear();
     foreach (var v in views)
     {
         CellUtil.CreateCellRenderer(this, null, v);
     }
 }
示例#6
0
 public void SetViews(CellViewCollection views)
 {
     theColumn.Clear();
     foreach (var v in views)
     {
         CellUtil.CreateCellRenderer(ApplicationContext, Frontend, this, theColumn, v);
     }
 }
示例#7
0
 public void SetViews(CellViewCollection views)
 {
     column.Views.Clear();
     foreach (var v in views)
     {
         column.Views.Add(v);
     }
     UpdateColumn(column, columnHandle, ListViewColumnChange.Cells);
 }
示例#8
0
文件: CellUtil.cs 项目: StEvUgnIn/xwt
		internal static FrameworkElementFactory CreateBoundColumnTemplate (ApplicationContext ctx, Widget parent, CellViewCollection views, string dataPath = ".")
		{
			if (views.Count == 1)
                return CreateBoundCellRenderer(ctx, parent, views[0], dataPath);
			
			FrameworkElementFactory container = new FrameworkElementFactory (typeof (StackPanel));
			container.SetValue (StackPanel.OrientationProperty, System.Windows.Controls.Orientation.Horizontal);

			foreach (CellView view in views) {
                container.AppendChild(CreateBoundCellRenderer(ctx, parent, view, dataPath));
			}

			return container;
		}
示例#9
0
        internal static FrameworkElementFactory CreateBoundColumnTemplate(CellViewCollection views, string dataPath = ".")
        {
            if (views.Count == 1)
            {
                return(CreateBoundCellRenderer(views [0], dataPath));
            }

            FrameworkElementFactory container = new FrameworkElementFactory(typeof(StackPanel));

            container.SetValue(StackPanel.OrientationProperty, Orientation.Horizontal);

            foreach (CellView view in views)
            {
                container.AppendChild(CreateBoundCellRenderer(view, dataPath));
            }

            return(container);
        }
示例#10
0
 public ListViewColumn()
 {
     views = new CellViewCollection (this);
 }
示例#11
0
        internal static FrameworkElementFactory CreateBoundColumnTemplate(ApplicationContext ctx, WidgetBackend parent, CellViewCollection views, string dataPath = ".")
        {
            if (views.Count == 1)
            {
                return(CreateBoundCellRenderer(ctx, parent, views[0], dataPath));
            }

            FrameworkElementFactory container = new FrameworkElementFactory(typeof(Grid));

            int i = 0;

            foreach (CellView view in views)
            {
                var factory = CreateBoundCellRenderer(ctx, parent, view, dataPath);

                factory.SetValue(FrameworkElement.MarginProperty, CellMargins);

                if (view.VisibleField != null)
                {
                    var binding = new Binding(dataPath + "[" + view.VisibleField.Index + "]");
                    binding.Converter = new BooleanToVisibilityConverter();
                    factory.SetBinding(UIElement.VisibilityProperty, binding);
                }
                else if (!view.Visible)
                {
                    factory.SetValue(UIElement.VisibilityProperty, Visibility.Collapsed);
                }

                factory.SetValue(FrameworkElement.HorizontalAlignmentProperty, view.Expands ? HorizontalAlignment.Stretch : HorizontalAlignment.Left);
                factory.SetValue(Grid.ColumnProperty, i);
                var column = new FrameworkElementFactory(typeof(ColumnDefinition));
                column.SetValue(ColumnDefinition.WidthProperty, new GridLength(1, view.Expands ? GridUnitType.Star : GridUnitType.Auto));

                container.AppendChild(column);
                container.AppendChild(factory);

                i++;
            }

            return(container);
        }
示例#12
0
		public void SetViews (CellViewCollection views)
		{
			Widget.Clear ();
			foreach (var v in views)
				CellUtil.CreateCellRenderer (ApplicationContext, Frontend, this, null, v);
		}
示例#13
0
 public void SetViews(CellViewCollection views)
 {
     ComboBox.ItemTemplate = GetDataTemplate (views);
 }
示例#14
0
 public void SetViews(CellViewCollection views)
 {
 }
示例#15
0
 public void SetViews(CellViewCollection views)
 {
     ComboBox.DisplayMemberPath = null;
     ComboBox.ItemTemplate      = GetDataTemplate(views);
 }
示例#16
0
 public void SetViews(CellViewCollection views)
 {
     Widget.Clear ();
     foreach (var v in views)
         CellUtil.CreateCellRenderer (this, null, v);
 }
示例#17
0
文件: ComboBox.cs 项目: chkn/xwt
 public ComboBox()
 {
     views = new CellViewCollection ((ICellContainer)WidgetEventSink);
 }
示例#18
0
 public void SetViews(CellViewCollection views)
 {
     ComboBox.DisplayMemberPath = null;
     ComboBox.ItemTemplate = GetDataTemplate(views);
 }
示例#19
0
        internal static FrameworkElementFactory CreateBoundColumnTemplate(ApplicationContext ctx, Widget parent, CellViewCollection views, string dataPath = ".")
        {
            if (views.Count == 1)
            {
                return(CreateBoundCellRenderer(ctx, parent, views[0], dataPath));
            }

            FrameworkElementFactory container = new FrameworkElementFactory(typeof(StackPanel));

            container.SetValue(StackPanel.OrientationProperty, System.Windows.Controls.Orientation.Horizontal);

            foreach (CellView view in views)
            {
                var factory = CreateBoundCellRenderer(ctx, parent, view, dataPath);

                factory.SetValue(FrameworkElement.MarginProperty, CellMargins);

                if (view.VisibleField != null)
                {
                    var binding = new Binding(dataPath + "[" + view.VisibleField.Index + "]");
                    binding.Converter = new BooleanToVisibilityConverter();
                    factory.SetBinding(UIElement.VisibilityProperty, binding);
                }
                else if (!view.Visible)
                {
                    factory.SetValue(UIElement.VisibilityProperty, Visibility.Collapsed);
                }

                container.AppendChild(factory);
            }

            return(container);
        }
示例#20
0
 public void SetViews(CellViewCollection views)
 {
     ComboBox.ItemTemplate = GetDataTemplate(views);
 }
示例#21
0
 public void SetViews(CellViewCollection views)
 {
     column.Views.Clear ();
     foreach (var v in views)
         column.Views.Add (v);
 }
示例#22
0
		public void SetViews (CellViewCollection views)
		{
			ListBox.DisplayMemberPath = null;
            ListBox.ItemTemplate = new DataTemplate { VisualTree = CellUtil.CreateBoundColumnTemplate(Context, Frontend, views) };
		}
示例#23
0
 public void SetViews(CellViewCollection views)
 {
     theColumn.Clear ();
     foreach (var v in views)
         CellUtil.CreateCellRenderer (this, theColumn, v);
 }
示例#24
0
 public ComboBox()
 {
     views = new CellViewCollection ((ICellContainer)BackendHost);
 }
示例#25
0
 public void SetViews(CellViewCollection views)
 {
     theColumn.Clear ();
     foreach (var v in views)
         CellUtil.CreateCellRenderer (ApplicationContext, this, theColumn, v, Widget.Model);
 }