|
<syncfusion:SfDataGrid Name="sfDataGrid"
RowHeight="100"
SelectedItem="{Binding SelectedItem,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
AutoGenerateColumns="True"
ItemsSource="{Binding OrderInfoCollection}">
……………………………………………..
………………………………….
………………………………
<syncfusion:GridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button Grid.Row="0" Content="SeteSelectedItem"
Command="{Binding ElementName=sfDataGrid, Path=DataContext.RowDataCommand, Mode=OneWay}"
CommandParameter="{Binding}"
syncfusion:FocusManagerHelper.FocusedElement="True">
</Button>
<ListView x:Name="listView" ItemsSource="{Binding Path=DataContext.AttachmentList, ElementName=sfDataGrid}" Grid.Row="1" ItemTemplate="{StaticResource AttachmentTemplate}">
</ListView>
</Grid>
</DataTemplate>
</syncfusion:GridTemplateColumn.CellTemplate>
……………………………
………………………………..
…………………………..
<DataTemplate x:Key="AttachmentTemplate">
<Grid>
<Button Content="{Binding}" Command="{Binding Path=DataContext.ListViewCommand,ElementName=sfDataGrid}"
CommandParameter="{Binding ElementName=listView}"/>
</Grid>
</DataTemplate> |
|
public void RowDataComandExecute(object obj)
{
var rowdataContent = (obj as OrderInfo);
//Here you can select the SfDataGrid row while click the Button in that row.
SelectedItem = rowdataContent;
}
public void ListViewCommandExcute(object obj)
{
var rowdataContent = (obj as ListView).DataContext as OrderInfo;
//Here you can select the SfDataGrid row while click the Button in that row of ListView.
SelectedItem = rowdataContent;
} |