Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
151164 | Feb 2,2020 02:50 PM UTC | Feb 5,2020 02:31 PM UTC | WPF | 5 |
![]() |
Tags: SfTreeGrid |
<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);
}
}
}
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.