This is a migrated thread and some comments may be shown as answers.

IsVisible coverter on a GridViewdataColumn

1 Answer 42 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nick Wood
Top achievements
Rank 1
Nick Wood asked on 08 Jun 2010, 05:02 AM
Hi All

I have tried all manor of solutions to this problem.

Basically I have an attributes table which contains a type. this type is bound to a GridViewComboBoxColumn. when the selection in this column is changed, it needs to set the isvisible value of other columns in the same grid row.

So, in the usual way, I have created a converter such as this:
public class AttributeIntTypeToEnabledConverter : IValueConverter 
    { 
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
        { 
            if (value != null
            { 
                int count = (int)value; 
                if (count == 1) 
                    return true
                else 
                    return false
            } 
            else 
            { 
                return false
            } 
        } 
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
        { 
            return null
        } 
    } 

in the xaml, the converter is called like this:
<telerikGridView:GridViewDataColumn x:Name="gridAttributes_attrValInt" Header="Value"  
                                                                        DataMemberBinding="{Binding attribute_id}"  
                                                                        IsVisible="{Binding attribute_id, Converter={StaticResource AttributeIntTypeToEnabledConverter}}"

The value for the cell is updated when the attribute_id is changed, but the visibility converter is never called.


the second option that I have tried is to use the GridViewdataColumn element, such as this:
IsVisible="{Binding ElementName=gridAttributes_AttributeType1, Path=SelectedValue, Converter={StaticResource AttributeIntTypeToEnabledConverter}}" 

gridAttributes_attributeType1 is the name of the GridViewComboBoxColumn.

This also does not call the converter as I suspect that the path SelectedValue does not exist in a GridViewComboBoxColumn.

The solution does call the converter however, if I bind it to a combo outside of the gridview..

Is there any solution to this problem.

Regards

Nick

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 09 Jun 2010, 04:13 PM
Hi Nick Wood,

While preparing a sample project for you, a conflict about the requirements has appeared and it is concerning the way of setting columns to be collapsed. So, please give us more details about your scenario - which columns are you trying to hide? Do you want when to hide the appropriate row when selecting a value from the ComboBox? Do you need them to show again on another event? 

Best wishes,
Maya
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Nick Wood
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or