This question is locked. New answers and comments are not allowed.
Hello,
I've defined a GridViewCommandRow and it's defined as
I've noticed that setting it I lose the grouping feature...is there a way to put it above the group panel?
Thanks
I've defined a GridViewCommandRow and it's defined as
public class GridViewCommandRow
{
public static readonly DependencyProperty IsEnabledProperty =
DependencyProperty.RegisterAttached("IsEnabled",
typeof(bool),
typeof(GridViewCommandRow),
new PropertyMetadata(false, OnIsEnabledChanged));
public GridViewCommandRow(RadGridView grid)
{
RadGridView = grid;
CommandRow = new ContentControl();
CommandRow.SetValue(Grid.RowProperty, 0);
if (ViewCommandTemplate == null)
{
var commandRowTemplate = Generic.GetInstance()["CommandRowTemplate"] as ControlTemplate;
if (commandRowTemplate != null)
ViewCommandTemplate = commandRowTemplate;
}
}
public ControlTemplate ViewCommandTemplate { get; set; }
private ContentControl CommandRow { get; set; }
public RadGridView RadGridView { get; private set; }
public static void SetIsEnabled(DependencyObject dependencyObject, string enabled)
{
bool convertedValue = Convert.ToBoolean(enabled);
dependencyObject.SetValue(IsEnabledProperty, convertedValue);
}
public static object GetIsEnabled(DependencyObject dependencyObject)
{
return dependencyObject.GetValue(IsEnabledProperty);
}
private static void OnIsEnabledChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
var radGridView = sender as RadGridView;
if (radGridView != null)
{
if ((bool)e.NewValue)
{
// Create new GridViewCommandRow and attach RadGridView events.
var commandRow = new GridViewCommandRow(radGridView);
commandRow.Attach();
}
}
}
private void Attach()
{
RadGridView.DataLoaded += RadGridView_DataLoaded;
}
private void RadGridView_DataLoaded(object sender, EventArgs e)
{
if (RadGridView.Items.Count > 0)
{
RadGridView.SelectedItem = RadGridView.Items[0];
}
Grid hierarchyGrid =
RadGridView.ChildrenOfType<
Grid
>().FirstOrDefault(c => c.Name == "HierrarchyBackground");
if (hierarchyGrid != null && CommandRow.Parent == null)
{
hierarchyGrid.Children.Add(CommandRow);
CommandRow.Template = ViewCommandTemplate;
}
}
}
I've noticed that setting it I lose the grouping feature...is there a way to put it above the group panel?
Thanks