本文整理汇总了C#中Xceed.Wpf.DataGrid.DataGridControl类的典型用法代码示例。如果您正苦于以下问题:C# DataGridControl类的具体用法?C# DataGridControl怎么用?C# DataGridControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGridControl类属于Xceed.Wpf.DataGrid命名空间,在下文中一共展示了DataGridControl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: UserControl_DataContextChanged
private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
var selectedItem = (DataContext as IEntityGridViewModel).SelectedItem;
if (selectedItem == null)
return;
Type type = selectedItem.GetType();
var relationshipProperties = type.GetProperties()
.Where(t =>
t.Name != "Relationships" &&
t.GetGetMethod().IsVirtual &&
t.PropertyType.IsGenericType &&
t.PropertyType.GetGenericTypeDefinition() == typeof(ICollection<>))
.ToList();
foreach (var property in relationshipProperties)
{
//Binding binding = new Binding() { Path = new PropertyPath("SelectedItem." + property.Name), Source = this.DataContext };
TextBlock textBlock = new TextBlock() { Text = property.Name };
//BindingOperations.SetBinding(textBlock, TextBlock.TextProperty, binding);
relatedEntitiesStackPanel.Children.Add(textBlock);
Binding binding = new Binding() { Path = new PropertyPath("SelectedItem." + property.Name), Source = this.DataContext };
DataGridControl listView = new DataGridControl();
var value = property.GetValue(selectedItem) as System.Collections.IEnumerable;
//listView.ItemsSource = value;
BindingOperations.SetBinding(listView, DataGrid.ItemsSourceProperty, binding);
relatedEntitiesStackPanel.Children.Add(listView);
}
}
开发者ID:jweimann,项目名称:webdb,代码行数:35,代码来源:RelatedEntitiesView.xaml.cs
示例2: GeneratorNodeFactory
public GeneratorNodeFactory( NotifyCollectionChangedEventHandler itemsChangedHandler,
NotifyCollectionChangedEventHandler groupsChangedHandler,
EventHandler<ExpansionStateChangedEventArgs> expansionStateChangedHandler,
EventHandler isExpandedChangingHandler,
EventHandler isExpandedChangedHandler,
DataGridControl dataGridControl )
{
if( itemsChangedHandler == null )
throw new ArgumentNullException( "itemsChangedHandler" );
if( groupsChangedHandler == null )
throw new ArgumentNullException( "groupsChangedHandler" );
if( expansionStateChangedHandler == null )
throw new ArgumentNullException( "expansionStateChangedHandler" );
if( isExpandedChangingHandler == null )
throw new ArgumentNullException( "isExpandedChangingHandler" );
if( isExpandedChangedHandler == null )
throw new ArgumentNullException( "isExpandedChangedHandler" );
m_itemsChangedHandler = itemsChangedHandler;
m_groupsChangedHandler = groupsChangedHandler;
m_expansionStateChangedHandler = expansionStateChangedHandler;
m_isExpandedChangingHandler = isExpandedChangingHandler;
m_isExpandedChangedHandler = isExpandedChangedHandler;
if( dataGridControl != null )
{
m_dataGridControl = new WeakReference( dataGridControl );
}
}
开发者ID:austinedeveloper,项目名称:WpfExtendedToolkit,代码行数:33,代码来源:GeneratorNodeFactory.cs
示例3: CreateGenerator
internal static CustomItemContainerGenerator CreateGenerator( DataGridControl parentGridControl, CollectionView collectionView, DataGridContext dataGridContext )
{
CustomItemContainerGenerator newGenerator = new CustomItemContainerGenerator( collectionView, dataGridContext, parentGridControl );
dataGridContext.SetGenerator( newGenerator );
return newGenerator;
}
开发者ID:wangws556,项目名称:duoduo-chat,代码行数:7,代码来源:CustomItemContainerGenerator.cs
示例4: SelectionManager
public SelectionManager( DataGridControl owner )
{
if( owner == null )
throw new ArgumentNullException( "owner" );
m_owner = owner;
}
开发者ID:Torion,项目名称:WpfExToolkit,代码行数:7,代码来源:SelectionManager.cs
示例5: BuildDetailStructure
/// <summary>
/// Builds collectionSource DetailDescriptions.ItemProperties and collection of detail columns.
/// </summary>
/// <param name="collectionSource"></param>
/// <param name="xceedControl"></param>
/// <param name="detail"></param>
public void BuildDetailStructure(DataGridCollectionViewSource collectionSource, DataGridControl xceedGrid,
DetailConfiguration detail)
{
Debug.Assert(null != collectionSource.DetailDescriptions);
Debug.Assert(1 == collectionSource.DetailDescriptions.Count);
_BuildCollectionSource(collectionSource.DetailDescriptions[0].ItemProperties);
_BuildColumnsCollection(detail.Columns);
// Add stops as detail of route.
xceedGrid.DetailConfigurations.Clear();
xceedGrid.DetailConfigurations.Add(detail);
// NOTE: Set this property so that columns with custom order properties from default
// settings were not added to grid automatically.
xceedGrid.DetailConfigurations[0].AutoCreateColumns = false;
// Collapse all detail and reexpand it.
List<DataGridContext> dataGridContexts = new List<DataGridContext>(xceedGrid.GetChildContexts());
foreach (DataGridContext dataGridContext in dataGridContexts)
{
dataGridContext.ParentDataGridContext.CollapseDetails(dataGridContext.ParentItem);
dataGridContext.ParentDataGridContext.ExpandDetails(dataGridContext.ParentItem);
}
}
开发者ID:erindm,项目名称:route-planner-csharp,代码行数:31,代码来源:GridStructureInitializer.cs
示例6: ff_DataContextChanged
private void ff_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
control = sender as DataGridControl;
this.inpc = e.NewValue as INotifyPropertyChanged;
if (this.inpc != null)
{
this.propInfo = e.NewValue.GetType().GetProperty(this.Path);
Debug.WriteLine("New DataContext: {0}", e.NewValue);
this.inpc.PropertyChanged += this.inpc_PropertyChanged;
}
}
开发者ID:GamesDesignArt,项目名称:Hawk,代码行数:11,代码来源:DataGridSetter.cs
示例7: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
#line 13 "..\..\..\..\..\bin\Common\UserControls\ShowProcessFile.xaml"
((System.Windows.Controls.TextBlock)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.TextBlock_MouseDown);
#line default
#line hidden
return;
case 2:
this.GridDetails = ((Xceed.Wpf.DataGrid.DataGridControl)(target));
#line 19 "..\..\..\..\..\bin\Common\UserControls\ShowProcessFile.xaml"
this.GridDetails.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.GridDetails_MouseDoubleClick);
#line default
#line hidden
return;
case 3:
this.tbView = ((Xceed.Wpf.DataGrid.Views.TableView)(target));
return;
}
this._contentLoaded = true;
}
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:26,代码来源:ShowProcessFile.g.i.cs
示例8: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.KitAssembly = ((WpfFront.Views.KitAssemblyView)(target));
return;
case 2:
this.stpDocList2 = ((System.Windows.Controls.StackPanel)(target));
return;
case 3:
this.txtSearch = ((System.Windows.Controls.TextBox)(target));
#line 59 "..\..\..\..\Trace\Views\KitAssemblyView.xaml"
this.txtSearch.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txtSearch_TextChanged);
#line default
#line hidden
return;
case 4:
this.chkLate = ((System.Windows.Controls.CheckBox)(target));
#line 60 "..\..\..\..\Trace\Views\KitAssemblyView.xaml"
this.chkLate.Checked += new System.Windows.RoutedEventHandler(this.chkLate_Checked);
#line default
#line hidden
#line 60 "..\..\..\..\Trace\Views\KitAssemblyView.xaml"
this.chkLate.Unchecked += new System.Windows.RoutedEventHandler(this.chkLate_Checked);
#line default
#line hidden
return;
case 5:
#line 61 "..\..\..\..\Trace\Views\KitAssemblyView.xaml"
((System.Windows.Controls.Image)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Image_MouseDown);
#line default
#line hidden
return;
case 6:
this.dgDocument = ((Xceed.Wpf.DataGrid.DataGridControl)(target));
#line 73 "..\..\..\..\Trace\Views\KitAssemblyView.xaml"
this.dgDocument.GotFocus += new System.Windows.RoutedEventHandler(this.dgDocument_Click);
#line default
#line hidden
return;
case 7:
this.ctnColsMenu1 = ((System.Windows.Controls.ContextMenu)(target));
return;
case 8:
#line 85 "..\..\..\..\Trace\Views\KitAssemblyView.xaml"
((System.Windows.Controls.MenuItem)(target)).MouseEnter += new System.Windows.Input.MouseEventHandler(this.MenuItem_MouseEnter);
#line default
#line hidden
return;
case 9:
this.tabMenu = ((System.Windows.Controls.TabControl)(target));
return;
case 10:
this.lvDocumentData = ((System.Windows.Controls.ListView)(target));
return;
case 11:
this.xRefresh = ((System.Windows.Controls.Image)(target));
#line 197 "..\..\..\..\Trace\Views\KitAssemblyView.xaml"
this.xRefresh.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.xRefresh_MouseDown);
#line default
#line hidden
return;
case 12:
this.btnRecTkt = ((System.Windows.Controls.Button)(target));
#line 200 "..\..\..\..\Trace\Views\KitAssemblyView.xaml"
this.btnRecTkt.Click += new System.Windows.RoutedEventHandler(this.btnRecTkt_Click);
#line default
#line hidden
return;
case 13:
this.ucDirectPrint = ((WpfFront.Common.UserControls.DirectPrint)(target));
return;
case 14:
this.btnPrintOpc = ((System.Windows.Controls.Button)(target));
#line 212 "..\..\..\..\Trace\Views\KitAssemblyView.xaml"
this.btnPrintOpc.Click += new System.Windows.RoutedEventHandler(this.btnPrintOpc_Click);
#line default
#line hidden
return;
case 15:
this.cboStatus = ((System.Windows.Controls.ComboBox)(target));
return;
//.........这里部分代码省略.........
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:101,代码来源:KitAssemblyView.g.cs
示例9: switch
//.........这里部分代码省略.........
case 33:
this.textProgressInformation = ((System.Windows.Controls.TextBlock)(target));
return;
case 34:
this.TextName = ((System.Windows.Controls.TextBox)(target));
return;
case 35:
#line 446 "..\..\..\..\..\Trace\Views\QueriesView.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);
#line default
#line hidden
return;
case 36:
this.btnUpd = ((System.Windows.Controls.Button)(target));
#line 448 "..\..\..\..\..\Trace\Views\QueriesView.xaml"
this.btnUpd.Click += new System.Windows.RoutedEventHandler(this.btnUpd_Click);
#line default
#line hidden
return;
case 37:
this.btnDelRep = ((System.Windows.Controls.Button)(target));
#line 451 "..\..\..\..\..\Trace\Views\QueriesView.xaml"
this.btnDelRep.Click += new System.Windows.RoutedEventHandler(this.btnDelRep_Click);
#line default
#line hidden
return;
case 38:
this.GridDetails = ((Xceed.Wpf.DataGrid.DataGridControl)(target));
return;
case 39:
this.tbView = ((Xceed.Wpf.DataGrid.Views.TableView)(target));
return;
case 40:
this.popUcFilters = ((System.Windows.Controls.Primitives.Popup)(target));
return;
case 41:
this.brDocList = ((System.Windows.Controls.Border)(target));
return;
case 42:
this.stkFilters = ((System.Windows.Controls.WrapPanel)(target));
return;
case 43:
this.btnPop = ((System.Windows.Controls.Button)(target));
#line 532 "..\..\..\..\..\Trace\Views\QueriesView.xaml"
this.btnPop.Click += new System.Windows.RoutedEventHandler(this.btnPop_Click);
#line default
#line hidden
return;
case 44:
#line 535 "..\..\..\..\..\Trace\Views\QueriesView.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_2);
#line default
#line hidden
return;
case 45:
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:66,代码来源:QueriesView.g.i.cs
示例10: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.Direccion_Solicitante = ((System.Windows.Controls.Grid)(target));
return;
case 2:
this.border_Copy7 = ((System.Windows.Controls.Border)(target));
return;
case 3:
this.datagrid1 = ((Xceed.Wpf.DataGrid.DataGridControl)(target));
return;
case 4:
this.But_Agregar = ((System.Windows.Controls.Button)(target));
#line 67 "..\..\..\..\..\Objs\Controles\Visitas\us_CitasMotivos.xaml"
this.But_Agregar.Click += new System.Windows.RoutedEventHandler(this.But_Agregar_Click);
#line default
#line hidden
return;
case 5:
this.But_Buscar_Copy = ((System.Windows.Controls.Button)(target));
return;
}
this._contentLoaded = true;
}
开发者ID:noedelarosa,项目名称:SIC,代码行数:27,代码来源:us_CitasMotivos.g.i.cs
示例11: CustomItemContainerGenerator
private CustomItemContainerGenerator( CollectionView collectionView, DataGridContext dataGridContext, DataGridControl gridControl )
{
if( collectionView == null )
{
throw new ArgumentNullException( "collectionView" );
}
if( dataGridContext == null )
{
throw new ArgumentNullException( "dataGridContext" );
}
if( gridControl == null )
{
throw new ArgumentNullException( "gridControl" );
}
m_dataGridControl = gridControl;
m_dataGridContext = dataGridContext;
m_collectionView = collectionView;
IList listInterface = m_collectionView as IList;
if( listInterface == null )
{
listInterface = m_collectionView.SourceCollection as IList;
}
m_listInterface = listInterface;
//initialize explicitly (set a local value) to the DataItem attached property (for nested DataGridControls)
CustomItemContainerGenerator.SetDataItemProperty( m_dataGridControl, CustomItemContainerGenerator.NotSet );
//Notify to the ItemCollection CollectionChanged event.
CollectionChangedEventManager.AddListener( m_collectionView, this );
//Notify to the DataGridControl's or DetailConfiguration GroupConfigurationSelector Changed event.
GroupConfigurationSelectorChangedEventManager.AddListener( m_dataGridContext, this );
CollectionChangedEventManager.AddListener( m_dataGridContext.DetailConfigurations, this );
// It would have been neat to create a DependencyPropertyChangedEventManager but the
// WeakEventManager was not made to work with DependencyPropertyDescriptor.AddValueChanged.
//identifies a Master generator
if( m_dataGridContext.SourceDetailConfiguration == null )
{
ItemsSourceChangeCompletedEventManager.AddListener( m_dataGridControl, this );
ViewChangedEventManager.AddListener( m_dataGridControl, this );
ThemeChangedEventManager.AddListener( m_dataGridControl, this );
}
m_nodeFactory = new GeneratorNodeFactory( this.OnGeneratorNodeItemsCollectionChanged,
this.OnGeneratorNodeGroupsCollectionChanged,
this.OnGeneratorNodeExpansionStateChanged,
this.OnGroupGeneratorNodeIsExpandedChanging,
this.OnGroupGeneratorNodeIsExpandedChanged );
m_headerFooterDataContextBinding = new Binding();
m_headerFooterDataContextBinding.Source = m_dataGridControl;
m_headerFooterDataContextBinding.Path = new PropertyPath( DataGridControl.DataContextProperty );
this.ResetNodeList();
this.IncrementCurrentGenerationCount();
}
开发者ID:wangws556,项目名称:duoduo-chat,代码行数:65,代码来源:CustomItemContainerGenerator.cs
示例12: _InitPrintConfiguration
/// <summary>
/// Method inits grid's print configuration
/// </summary>
/// <param name="xceedGrid"></param>
private void _InitPrintConfiguration(DataGridControl xceedGrid)
{
// if current page contains "Print" button and print configuration defined in structure
if (_headerTemplate != null)
{
PrintTableView view = new PrintTableView();
view.PageHeaders.Add(_headerTemplate);
view.PageFooters.Add((DataTemplate)App.Current.FindResource(PRINT_FOOTER_RESOURCE_NAME));
xceedGrid.PrintView = view;
}
}
开发者ID:erindm,项目名称:route-planner-csharp,代码行数:15,代码来源:GridStructureInitializer.cs
示例13: ProcessDrop
private void ProcessDrop(DataGridControl lvDest, GetPositionDelegate mousePoint)
{
if (curSource == lvDest)
return;
if (sourceIndex < 0)
return;
int index = this.GetCurrentIndex(mousePoint, lvDest);
if (index < 0)
index = 0; //return;
((IList<IqReportColumn>)curSource.Items.SourceCollection).Remove(selectedItem);
if (curSource.Name == "lvDest")
//Remueve de los seleccionados cambia el visible a false
RemoveFromSelected(this, new DataEventArgs<IqReportColumn>(selectedItem));
//Destination Operation
if (((IList<IqReportColumn>)lvDest.Items.SourceCollection).Where(f => f.ReportColumnId == selectedItem.ReportColumnId).Count() == 0)
{
//Add Trask By User
if (lvDest.Name == "lvDest")
AddToSelected(this, new DataEventArgs<IqReportColumn>(selectedItem));
((IList<IqReportColumn>)lvDest.Items.SourceCollection).Insert(index, selectedItem);
}
lvDest.Items.Refresh();
curSource.Items.Refresh();
}
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:36,代码来源:QueriesView.xaml.cs
示例14: switch
//.........这里部分代码省略.........
#line default
#line hidden
return;
case 7:
#line 115 "..\..\..\..\..\Trace\Views\OrderMngrV2View.xaml"
((System.Windows.Controls.Image)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Image_MouseDown);
#line default
#line hidden
return;
case 8:
this.bntReset = ((System.Windows.Controls.Button)(target));
#line 119 "..\..\..\..\..\Trace\Views\OrderMngrV2View.xaml"
this.bntReset.Click += new System.Windows.RoutedEventHandler(this.bntReset_Click);
#line default
#line hidden
return;
case 9:
this.ucDocList = ((WpfFront.Common.UserControls.DocumentList)(target));
return;
case 10:
this.tabStep = ((System.Windows.Controls.TabControl)(target));
#line 141 "..\..\..\..\..\Trace\Views\OrderMngrV2View.xaml"
this.tabStep.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.tabStep_SelectionChanged);
#line default
#line hidden
return;
case 11:
this.docName = ((System.Windows.Controls.StackPanel)(target));
return;
case 12:
this.chkAll = ((System.Windows.Controls.TextBlock)(target));
#line 153 "..\..\..\..\..\Trace\Views\OrderMngrV2View.xaml"
this.chkAll.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.chkAll_MouseDown);
#line default
#line hidden
return;
case 13:
this.uncheckAll = ((System.Windows.Controls.TextBlock)(target));
#line 155 "..\..\..\..\..\Trace\Views\OrderMngrV2View.xaml"
this.uncheckAll.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.uncheckAll_MouseDown);
#line default
#line hidden
return;
case 14:
this.dgDetails = ((System.Windows.Controls.ListView)(target));
#line 170 "..\..\..\..\..\Trace\Views\OrderMngrV2View.xaml"
this.dgDetails.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.dgDetails_SelectionChanged);
#line default
#line hidden
#line 171 "..\..\..\..\..\Trace\Views\OrderMngrV2View.xaml"
this.dgDetails.AddHandler(System.Windows.Controls.Primitives.ButtonBase.ClickEvent, new System.Windows.RoutedEventHandler(this.dgDetails_Click));
#line default
#line hidden
return;
case 15:
this.gvLines = ((System.Windows.Controls.GridView)(target));
return;
case 17:
this.dgVendorDetails = ((System.Windows.Controls.ListView)(target));
return;
case 18:
this.txtComment = ((System.Windows.Controls.TextBox)(target));
return;
case 19:
this.dgSelected = ((Xceed.Wpf.DataGrid.DataGridControl)(target));
return;
case 20:
this.cboProcess = ((System.Windows.Controls.ComboBox)(target));
return;
case 21:
#line 375 "..\..\..\..\..\Trace\Views\OrderMngrV2View.xaml"
((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);
#line default
#line hidden
return;
case 22:
this.popup3 = ((System.Windows.Controls.Primitives.Popup)(target));
return;
case 23:
this.ucDocLine = ((WpfFront.Common.UserControls.AdminDocumentLine)(target));
return;
}
this._contentLoaded = true;
}
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:101,代码来源:OrderMngrV2View.g.cs
示例15: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.AdminTrackOption = ((WpfFront.Views.AdminTrackOptionView)(target));
return;
case 2:
this.stkSearchForm = ((System.Windows.Controls.StackPanel)(target));
return;
case 3:
this.dgSearch = ((System.Windows.Controls.Grid)(target));
return;
case 4:
this.btnNew = ((System.Windows.Controls.Button)(target));
#line 50 "..\..\..\..\..\General\Views\AdminTrackOptionView.xaml"
this.btnNew.Click += new System.Windows.RoutedEventHandler(this.btnNew_Click);
#line default
#line hidden
return;
case 5:
this.dgList = ((Xceed.Wpf.DataGrid.DataGridControl)(target));
#line 65 "..\..\..\..\..\General\Views\AdminTrackOptionView.xaml"
this.dgList.GotFocus += new System.Windows.RoutedEventHandler(this.dgList_GotFocus);
#line default
#line hidden
return;
case 6:
this.stkEdit = ((System.Windows.Controls.StackPanel)(target));
return;
case 7:
this.frmNotification = ((Core.WPF.FormNotification)(target));
return;
case 8:
this.dgEdit = ((System.Windows.Controls.Grid)(target));
return;
case 9:
this.btnSave = ((System.Windows.Controls.Button)(target));
#line 189 "..\..\..\..\..\General\Views\AdminTrackOptionView.xaml"
this.btnSave.Click += new System.Windows.RoutedEventHandler(this.btnSave_Click);
#line default
#line hidden
return;
}
this._contentLoaded = true;
}
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:51,代码来源:AdminTrackOptionView.g.cs
示例16: UpdateColumnsOnItemsPropertiesChanged
public static void UpdateColumnsOnItemsPropertiesChanged(
DataGridControl dataGridControl,
ColumnCollection columns,
bool autoCreateForeignKeyConfigurations,
NotifyCollectionChangedEventArgs e,
DataGridItemPropertyCollection itemProperties )
{
if( dataGridControl == null )
return;
switch( e.Action )
{
case NotifyCollectionChangedAction.Add:
{
foreach( DataGridItemPropertyBase itemProperty in e.NewItems )
{
string name = itemProperty.Name;
if( columns[ name ] == null )
{
Column column = ItemsSourceHelper.CreateColumnFromItemsSourceField(
dataGridControl, dataGridControl.DefaultCellEditors,
ItemsSourceHelper.CreateFieldFromDataGridItemProperty( itemProperty ),
autoCreateForeignKeyConfigurations );
if( column != null )
{
columns.Add( column );
ItemsSourceHelper.ApplySettingsRepositoryToColumn( column );
}
}
}
}
break;
case NotifyCollectionChangedAction.Remove:
{
foreach( DataGridItemPropertyBase itemProperty in e.OldItems )
{
string name = itemProperty.Name;
Column column = columns[ name ] as Column;
if( ( column != null ) && ( column.IsAutoCreated ) )
{
columns.Remove( column );
}
}
break;
}
case NotifyCollectionChangedAction.Replace:
{
foreach( DataGridItemPropertyBase itemProperty in e.OldItems )
{
string name = itemProperty.Name;
Column column = columns[ name ] as Column;
if( ( column != null ) && ( column.IsAutoCreated ) )
{
columns.Remove( column );
}
}
foreach( DataGridItemPropertyBase itemProperty in e.NewItems )
{
string name = itemProperty.Name;
if( columns[ name ] == null )
{
Column column = ItemsSourceHelper.CreateColumnFromItemsSourceField(
dataGridControl, dataGridControl.DefaultCellEditors,
ItemsSourceHelper.CreateFieldFromDataGridItemProperty( itemProperty ),
autoCreateForeignKeyConfigurations );
if( column != null )
{
columns.Add( column );
ItemsSourceHelper.ApplySettingsRepositoryToColumn( column );
}
}
}
break;
}
case NotifyCollectionChangedAction.Reset:
{
for( int i = columns.Count - 1; i >= 0; i-- )
{
Column dataColumn = columns[ i ] as Column;
if( ( dataColumn != null ) && ( dataColumn.IsAutoCreated ) )
{
columns.Remove( dataColumn );
}
}
foreach( DataGridItemPropertyBase itemProperty in itemProperties )
//.........这里部分代码省略.........
开发者ID:Torion,项目名称:WpfExToolkit,代码行数:101,代码来源:ItemsSourceHelper.cs
示例17: AddNewDataItem
public static object AddNewDataItem(
IEnumerable itemsSourceCollection,
DataGridControl dataGridControl,
out int itemIndex )
{
DataGridCollectionViewBase dataGridCollectionViewBase = itemsSourceCollection as DataGridCollectionViewBase;
if( dataGridCollectionViewBase != null )
{
if( !dataGridCollectionViewBase.CanAddNew )
throw new InvalidOperationException( "An attempt was made to add a new data item to a source that does not support insertion." );
itemIndex = dataGridCollectionViewBase.Count;
return dataGridCollectionViewBase.AddNew();
}
if( ( dataGridControl != null ) && ( dataGridControl.ItemsSource == null ) )
{
//unbound
#pragma warning disable 618
AddingNewDataItemEventArgs eventArgs = new AddingNewDataItemEventArgs();
dataGridControl.OnAddingNewDataItem( eventArgs );
object newItem = eventArgs.DataItem;
#pragma warning restore 618
if( newItem == null )
throw new InvalidOperationException( "The AddingNewDataItem event did not return a new data item because the grid is not bound to a data source." );
itemIndex = dataGridControl.Items.Add( newItem );
return newItem;
}
DataView dataView = itemsSourceCollection as DataView;
if( dataView == null )
{
CollectionView collectionView = itemsSourceCollection as CollectionView;
dataView = ( collectionView == null ) ?
null : collectionView.SourceCollection as DataView;
}
if( dataView != null )
{
itemIndex = dataView.Count;
return dataView.AddNew();
}
IBindingList bindingList = itemsSourceCollection as IBindingList;
if( bindingList == null )
{
CollectionView collectionView = itemsSourceCollection as CollectionView;
bindingList = ( collectionView == null ) ?
null : collectionView.SourceCollection as IBindingList;
}
if( ( bindingList != null ) && ( bindingList.AllowNew ) )
{
itemIndex = bindingList.Count;
return bindingList.AddNew();
}
Type itemType = ItemsSourceHelper.GetItemTypeFromEnumeration( itemsSourceCollection );
if( itemType == null )
throw new InvalidOperationException( "An attempt was made to use a source whose item type cannot be determined." );
try
{
itemIndex = -1;
return Activator.CreateInstance( itemType );
}
catch( MissingMethodException exception )
{
throw new InvalidOperationException( "An attempt was made to use a source whose item type does not have a default constructor.", exception );
}
catch( Exception exception )
{
throw new InvalidOperationException( "An unsuccessful attempt was made to create an instance of the source's item type using the item's default constructor.", exception );
}
}
开发者ID:Torion,项目名称:WpfExToolkit,代码行数:83,代码来源:ItemsSourceHelper.cs
示例18: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.ShippingConsole = ((WpfFront.Views.ShippingConsoleView)(target));
return;
case 2:
this.lvNotification = ((System.Windows.Controls.ListView)(target));
return;
case 3:
this.exToday = ((Odyssey.Controls.OdcExpander)(target));
#line 45 "..\..\..\..\Trace\Views\ShippingConsoleView.xaml"
this.exToday.Expanded += new System.Windows.RoutedEventHandler(this.exToday_Expanded);
#line default
#line hidden
return;
case 4:
this.lvToday = ((Xceed.Wpf.DataGrid.DataGridControl)(target));
return;
case 5:
this.exWeek = ((Odyssey.Controls.OdcExpander)(target));
#line 106 "..\..\..\..\Trace\Views\ShippingConsoleView.xaml"
this.exWeek.Expanded += new System.Windows.RoutedEventHandler(this.exWeek_Expanded);
#line default
#line hidden
return;
case 6:
this.lvWeek = ((System.Windows.Controls.ListView)(target));
return;
case 7:
this.exMonth = ((Odyssey.Controls.OdcExpander)(target));
#line 123 "..\..\..\..\Trace\Views\ShippingConsoleView.xaml"
this.exMonth.Expanded += new System.Windows.RoutedEventHandler(this.exMonth_Expanded);
#line default
#line hidden
return;
case 8:
this.lvMonth = ((System.Windows.Controls.ListView)(target));
return;
case 9:
this.btnPrint = ((System.Windows.Controls.Button)(target));
#line 160 "..\..\..\..\Trace\Views\ShippingConsoleView.xaml"
this.btnPrint.Click += new System.Windows.RoutedEventHandler(this.btnPrint_Click);
#line default
#line hidden
return;
case 10:
this.btnAutomatic = ((System.Windows.Controls.Button)(target));
#line 167 "..\..\..\..\Trace\Views\ShippingConsoleView.xaml"
this.btnAutomatic.Click += new System.Windows.RoutedEventHandler(this.btnAutomatic_Click);
#line default
#line hidden
return;
case 11:
this.cboPicker = ((System.Windows.Controls.ComboBox)(target));
#line 181 "..\..\..\..\Trace\Views\ShippingConsoleView.xaml"
this.cboPicker.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.cboPicker_SelectionChanged);
#line default
#line hidden
return;
case 12:
this.stkPikerOrders = ((System.Windows.Controls.StackPanel)(target));
return;
case 13:
this.lvPickOrders = ((Xceed.Wpf.DataGrid.DataGridControl)(target));
return;
}
this._contentLoaded = true;
}
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:81,代码来源:ShippingConsoleView.g.cs
示例19: GetCurrentIndex
// returns the index of the item in the ListView
int GetCurrentIndex(GetPositionDelegate getPosition, DataGridControl lvObject)
{
int index = -1;
for (int i = 0; i < lvObject.Items.Count; ++i)
{
Row item = GetListViewItem(i, lvObject);
if (item != null && this.IsMouseOverTarget(item, getPosition))
{
index = i;
break;
}
}
return index;
}
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:17,代码来源:QueriesView.xaml.cs
示例20: GetListViewItem
Row GetListViewItem(int index, DataGridControl lvObject)
{
//if (lvObject.ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated)
// return null;
//return lvObject.ItemContainerGenerator.ContainerFromIndex(index) as ListViewItem;
return lvObject.GetContainerFromIndex(index) as Row;
}
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:8,代码来源:QueriesView.xaml.cs
注:本文中的Xceed.Wpf.DataGrid.DataGridControl类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论