Completed
Last Updated: 16 Feb 2017 15:06 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 31 Jan 2017 11:37
Category: DataFilter
Type: Feature Request
1
ADD. RadDataFilter - show check boxes for Boolean fields not only in edit mode
Workaround: 
public RadForm1()
{ 
    InitializeComponent();

    this.radDataFilter1.NodeFormatting += radDataFilter1_NodeFormatting;
    this.radDataFilter1.Editing += radDataFilter1_Editing;
}

private void radDataFilter1_Editing(object sender, TreeNodeEditingEventArgs e)
{
    e.Cancel = e.Editor is DataFilterCheckboxEditor;
}

private void radDataFilter1_NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
{
    DataFilterCriteriaElement nodeElement = e.NodeElement as DataFilterCriteriaElement;
    if (nodeElement != null)
    {
        nodeElement.ValueElement.DrawText = true;
        if (nodeElement.ValueElement.Children.Count == 0)
        {
            if (nodeElement.FieldElement.Text == "Discontinued")
            {
                RadCheckBoxElement checkBox = new RadCheckBoxElement();
                nodeElement.ValueElement.Children.Add(checkBox);
                checkBox.Alignment = ContentAlignment.MiddleCenter;
                checkBox.CheckStateChanged += checkBox_CheckStateChanged;
                checkBox.StretchHorizontally = false;
                nodeElement.ValueElement.DrawText = false;
            }
        }
        else
        {
            RadCheckBoxElement checkBox = nodeElement.ValueElement.FindDescendant<RadCheckBoxElement>();
            if (checkBox != null && nodeElement.FieldElement.Text != "Discontinued")
            {
                nodeElement.ValueElement.Children.Remove(checkBox);
            }
            else
            {
                nodeElement.ValueElement.DrawText = false;
            }
        }
    }
}

private void checkBox_CheckStateChanged(object sender, EventArgs e)
{
    RadCheckBoxElement checkBox = sender as RadCheckBoxElement;
    DataFilterCriteriaElement criteriElement = checkBox.Parent.FindAncestor<DataFilterCriteriaElement>();
    criteriElement.CriteriaNode.Descriptor.Value = checkBox.IsChecked;
}
Attached Files:
0 comments