BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
<syncfusion:TreeGridTemplateColumn x:Name="sfTreeFileColumn" HeaderText="Filnavn" MappingName="Filename" AllowSorting="False" ColumnSizer="Auto" HorizontalHeaderContentAlignment="Left" MaximumWidth="180" MinimumWidth="120" AllowEditing="False" ShowToolTip="True" > <syncfusion:TreeGridTemplateColumn.CellTemplate> <DataTemplate> <Grid> <TextBlock Text="{Binding Filename}" VerticalAlignment="Center" Margin="3,0,0,0"/> <WrapPanel HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0" Visibility="{Binding ...}"> <Button ToolTip="Nulstil" Background="{x:Null}" BorderBrush="{x:Null}" > <fa5:SvgAwesome Icon="Solid_Eraser" Width="10" Height="10" /> </Button> <Button ToolTip="Vælg fil" Margin="3,0,0,0" Command="{Binding AddFilesCommand, Source={StaticResource viewModel}}" CommandParameter="{Binding}">...</Button> </WrapPanel> </Grid> </DataTemplate> </syncfusion:TreeGridTemplateColumn.CellTemplate> </syncfusion:TreeGridTemplateColumn> |
Also?
When shown on hover, how to ensure button events on first click on buttons inside the datatemplate?
Thanks in advance.
Best regards,
Johannes
<syncfusion:TreeGridTemplateColumn MappingName="Title" SetCellBoundValue="True" >
<syncfusion:TreeGridTemplateColumn.CellTemplate>
<DataTemplate>
<Grid>
<local:GridButtonColumn syncfusion:FocusManagerHelper.FocusedElement="True"/>
</Grid>
</DataTemplate>
</syncfusion:TreeGridTemplateColumn.CellTemplate>
</syncfusion:TreeGridTemplateColumn> |
<StackPanel Orientation="Horizontal" Width="150" >
<TextBlock x:Name="textBlock" Text="{Binding Value}" Width="50" Height="30" Visibility="Visible" syncfusion:FocusManagerHelper.FocusedElement="True"/>
<Button x:Name="button2" Content="Button2" Visibility="Visible" Width="50" Height="30" Click="Button2_Click" syncfusion:FocusManagerHelper.FocusedElement="True"/>
<Button x:Name="button3" Content="Button3" Visibility="Visible" Width="50" Height="30" Click="Button3_Click" syncfusion:FocusManagerHelper.FocusedElement="True"/>
</StackPanel>
public class GridSelectionControllerExt : TreeGridRowSelectionController
{
SfTreeGrid sfTreeGrid;
public GridSelectionControllerExt(SfTreeGrid treeGrid)
: base(treeGrid)
{
sfTreeGrid = treeGrid;
}
protected override void ProcessKeyDown(KeyEventArgs args)
{
base.ProcessKeyDown(args);
if (CurrentCellManager.CurrentCell.TreeGridColumn is TreeGridTemplateColumn)
{
CurrentCellManager.CurrentCell.Renderer.SetFocus(true);
}
}
//public override void HandlePointerOperations(GridPointerEventArgs args, RowColumnIndex rowColumnIndex)
//{
// base.HandlePointerOperations(args, rowColumnIndex);
// if (args.Operation == PointerOperation.Released)
// {
// if (CurrentCellManager.CurrentCell.TreeGridColumn is TreeGridTemplateColumn)
// {
// CurrentCellManager.CurrentCell.Renderer.SetFocus(true);
// }
// }
//}
}
|
public class GridSelectionControllerExt : TreeGridRowSelectionController
{
SfTreeGrid sfTreeGrid;
public GridSelectionControllerExt(SfTreeGrid treeGrid)
: base(treeGrid)
{
sfTreeGrid = treeGrid;
}
protected override void ProcessKeyDown(KeyEventArgs args)
{
base.ProcessKeyDown(args);
if (CurrentCellManager.CurrentCell.TreeGridColumn is TreeGridTemplateColumn)
{
CurrentCellManager.CurrentCell.Renderer.SetFocus(true);
}
}
public override void HandlePointerOperations(GridPointerEventArgs args, RowColumnIndex rowColumnIndex)
{
base.HandlePointerOperations(args, rowColumnIndex);
if (args.Operation == PointerOperation.Move)
{
if (sfTreeGrid.Columns[rowColumnIndex.ColumnIndex] is TreeGridTemplateColumn)
{
this.sfTreeGrid.SelectionController.MoveCurrentCell(rowColumnIndex, false);
CurrentCellManager.CurrentCell.Renderer.SetFocus(true);
}
}
}
} |