i have a data grid that has a list bound to it. i added and unbounded field in the xaml but it isnt showing. i was to add two buttons in the unbounded field to delete or change a property in the row
Hello Pette,
I am just checking your progress on the issue that you are having.
If you require any further assistance please do not hesitate to ask.
I have been looking into your question and I modified the sample application to show you how you can implement the functionality that you want to achieve. You can handle the click event of the button and in the event handler you can use the Utilities class to get the DataRecord of the current DataPresenter.
Please let me know if you need any further assistance on this matter.
i believe i have figure out my issue, however i have a new question. i programmatically add a field to the xamdatagrid with the following style. however the event fire and act upon my active record as per the method i am calling. is there a way i can tell where the button click occured. Meaning if i click on the unbound button in row one can i tell it was click on in that row?
<Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="buttonFieldStyle"> <Setter Property="Visibility" Value="Visible"/> <Setter Property="Padding" Value="0"/> <Setter Property="Margin" Value="2,0,0,0"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Image Source="/DeVilbiss.SmartLink.Controls;component/Resources/CameraOrbit.png" Width="20" Height="20" Grid.Column="1" Cursor="Hand" MouseLeftButtonDown="Image_MouseLeftButtonDown_ChangeStatus" ToolTip="{Binding Path=ChangeStatus, Source={x:Static Internationalization:CultureResources.CultureStrings}}"/>
<Image Source="/DeVilbiss.SmartLink.Controls;component/Resources/delete_over.png" Width="20" Height="20" Grid.Column="2" Cursor="Hand" MouseLeftButtonDown="Image_MouseLeftButtonDown" ToolTip="{Binding Path=Button_Delete, Source={x:Static Internationalization:CultureResources.CultureStrings}}" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
i think it has something to do with this
A FieldLayout defines the Fields (columns) contained in a particular DataRecord. When a DataRecord is created, the FieldLayouts collection is searched for an existing FieldLayout whose Fields match the DataItem's properties. If a FieldLayout is found, it is associated with the DataRecord; if it is not found, a new FieldLayout is created. When a new FieldLayout is created, the FieldLayoutInitializing and FieldLayoutInitialized events are raised.
If the new FieldLayout's AutoGenerateFieldsResolved property returns True, the Fields collection is automatically populated with a Field for every public property on the data item.
its like it doesnt see my unbounded field in the xaml because the field layouts are being populated automatically???
here is my xaml without trying to add the unbounded field, the datasource changes based upon selected entity in our software so it will have differnet fields based on what the CurrentListSource contains. however i need the buttons added to the grid regarless of the other fields.
<igDP:XamDataGrid DataSource="{Binding ElementName=summaryPanel, Path=CurrentListSource}" Name="entityGrid" AutoFit="True" RecordActivated="OnRecordActivated" MouseDoubleClick="entityGrid_MouseDoubleClick" FieldLayoutInitialized="GridFieldLayoutInitialized" GroupByAreaLocation="None" Loaded="entityGrid_Loaded"> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings AutoGenerateFields="False" SelectionTypeCell="None" SelectionTypeField="None" SelectionTypeRecord="None" /> </igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.Resources> <ContextMenu HasDropShadow="True" x:Key="imageMenu" > <MenuItem Header="{Binding Path=Button_Delete, Source={x:Static Internationalization:CultureResources.CultureStrings}}" Command="Controls:AppCommands.MainDelete" /> <MenuItem Header="{Binding Path=ChangeStatus, Source={x:Static Internationalization:CultureResources.CultureStrings}}" Command="Controls:AppCommands.ChangeStatus"/> </ContextMenu> <Style TargetType="{x:Type igDP:DataRecordCellArea}" > <Setter Property="ContextMenu" Value="{StaticResource imageMenu}" /> <EventSetter Event="ContextMenuOpening" Handler="OnContextMenuOpening" /> </Style> </igDP:XamDataGrid.Resources> </igDP:XamDataGrid>