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

[Solved] Binding is not working properly when using GroupDescriptors (in the new version)

6 Answers 244 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Victor
Top achievements
Rank 1
Victor asked on 01 Dec 2010, 12:59 PM
Hi everyone!

I've got 2 GridViews and I pass items from one gridview to the other.
Before I updated the Telerik tools it was working perfectly, but now the gridview doesn't refresh its content automatically if i'm using a groupdescriptor. Can U help me please? (Forgive my broken english)

XAML:
<Controls2:RadGridView x:Name="PermisosAsignats" ItemsSource="{Binding CurrentGrup.Permisos, Mode=TwoWay, UpdateSourceTrigger=Default}" Grid.Row="1" Grid.Column="0"
SelectedItem="{Binding CurrentPermis, Mode=TwoWay}" RowIndicatorVisibility="Collapsed" AutoGenerateColumns="False" VerticalAlignment="Stretch"  AlternateRowBackground="#FFF9F193" AlternationCount="2" CanUserFreezeColumns="True" BorderThickness="0" CanUserResizeColumns="False" ShowGroupPanel="True" Margin="0,0,0,1" Width="Auto" ShowInsertRow="False" ShowColumnFooters="False" IsReadOnly="True" IsFilteringAllowed="True" CanUserDeleteRows="False" CanUserInsertRows="False" RowLoaded="PermisosAsignats_RowLoaded" LayoutUpdated="PermisosAsignats_LayoutUpdated" ElementExported="PermisosAsignats_ElementExported" DistinctValuesLoading="PermisosAsignats_DistinctValuesLoading" Deleted="PermisosAsignats_Deleted" DataLoaded="PermisosAsignats_DataLoaded" CellLoaded="PermisosAsignats_CellLoaded" AddingNewDataItem="PermisosAsignats_AddingNewDataItem" Loaded="PermisosAsignats_Loaded"
                             >
 
                <Controls2:RadGridView.Columns>
                    <Controls2:GridViewDataColumn DataMemberBinding="{Binding Permis, Mode=TwoWay, UpdateSourceTrigger=Default}"  IsResizable="True" Header="{Binding Source={StaticResource AdministracioRecursos}, Path=Strings.Permis}" IsGroupable="true" />
                    <Controls2:GridViewDataColumn DataMemberBinding="{Binding AgrupacioPermisos.Descripcio, Mode=TwoWay, UpdateSourceTrigger=Default}"  IsResizable="True" Header="{Binding Source={StaticResource AdministracioRecursos}, Path=Strings.AgrupacioPermisos}" IsGroupable="true" />
                </Controls2:RadGridView.Columns>
 
                <Controls2:RadGridView.GroupDescriptors>
                    <data:GroupDescriptor Member="AgrupacioPermisos.Descripcio" DisplayContent="{Binding Source={StaticResource AdministracioRecursos}, Path=Strings.GrupPermisos, Mode=TwoWay}" />
                </Controls2:RadGridView.GroupDescriptors>
 
            </Controls2:RadGridView>
 
            <Controls2:RadGridView x:Name="PermisosTots" Grid.Row="1" Grid.Column="2"
                             ItemsSource="{Binding PermisosNoAsignats, Mode=TwoWay, UpdateSourceTrigger=Default}"
                             SelectedItem="{Binding Mode=TwoWay, Path=CurrentItem}"
                             RowIndicatorVisibility="Collapsed" AutoGenerateColumns="False" VerticalAlignment="Stretch"      
                             CanUserFreezeColumns="True" BorderThickness="0" CanUserResizeColumns="False"
                             Margin="0,0,0,1" Width="Auto" ShowInsertRow="False" ShowColumnFooters="False"
                             AlternateRowBackground="#FFF9F193" AlternationCount="2" IsReadOnly="True" IsFilteringAllowed="True"
                             CanUserDeleteRows="False" CanUserInsertRows="False" Loaded="PermisosTots_Loaded">
 
                <Controls2:RadGridView.Columns>
                    <Controls2:GridViewDataColumn DataMemberBinding="{Binding Permis, Mode=TwoWay, UpdateSourceTrigger=Default}" IsResizable="True" Header="{Binding Source={StaticResource AdministracioRecursos}, Path=Strings.Permis}" IsGrupable="true"/>
                    <Controls2:GridViewDataColumn DataMemberBinding="{Binding AgrupacioPermisos.Descripcio, Mode=TwoWay, UpdateSourceTrigger=Default}"  IsResizable="True" Header="{Binding Source={StaticResource AdministracioRecursos}, Path=Strings.AgrupacioPermisos}" IsGroupable="true" />
                </Controls2:RadGridView.Columns>
 
                <Controls2:RadGridView.GroupDescriptors>
                    <data:GroupDescriptor Member="AgrupacioPermisos.Descripcio"  DisplayContent="{Binding Source={StaticResource AdministracioRecursos}, Path=Strings.GrupPermisos, Mode=TwoWay}"/>
                </Controls2:RadGridView.GroupDescriptors>


ViewModel:
private void AddPermiso(object param)
        {
            if (CurrentItem != null)
            {
                if (!CurrentGrup.Permisos.Contains(CurrentItem))
                {
                    CurrentGrup.Permisos.Add(CurrentItem);
                    PermisosNoAsignats.Remove(CurrentItem);
 
                    if (PermisosNoAsignats.Count > 0)
                        CurrentItem = PermisosNoAsignats[0];
                }
            }
        }
 
        private void RemovePermiso(object param)
        {
            if (CurrentPermis != null)
            {
                if (CurrentGrup.Permisos.Contains(CurrentPermis))
                {
                    PermisosNoAsignats.Add(CurrentPermis);
                    CurrentGrup.Permisos.Remove(CurrentPermis);
                }
            }
        }

6 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 01 Dec 2010, 01:09 PM
Hi Victor,

Can you please try with the new ColumnGroupDescriptor? It should be created in code as it needs to have its Column property set.

If it does not help please prepare a sample project and send it to us in a separate support ticket.

Thanks

All the best,
Veselin Vasilev
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Victor
Top achievements
Rank 1
answered on 01 Dec 2010, 02:12 PM
Thanks.
I have tryed using ColumnGroupDescriptor programmatically, but it didn't help at all 'cause I have the same problem.
Now, can u show me an example of how to use the ColumnFilterDescriptor???
I've done something like that:
ColumnFilterDescriptor descriptor = new ColumnFilterDescriptor((IDataFieldDescriptor)this.PermisosTots.Columns[0]);
PermisosTots.FilterDescriptors.Add(descriptor);
PermisosAsignats.FilterDescriptors.Add(descriptor);
And nothing seems to happen. No grouping in the gridviews.

Thanks in advance.
0
Rossen Hristov
Telerik team
answered on 01 Dec 2010, 03:05 PM
Hello Victor,

What you are using is a ColumnFilterDescriptor, not a ColumnGroupDescriptor.

Sincerely yours,
Ross
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Victor
Top achievements
Rank 1
answered on 02 Dec 2010, 06:01 PM
OK, as I said I tryed using the ColumnGroupDescriptor....and the same thing is happening.

My code:
descriptor = new ColumnGroupDescriptor
                  {
                      Column = PermisosTots.Columns[1],
                      DisplayContent = "Grup de permisos"
                  };
PermisosTots.GroupDescriptors.Add(descriptor);
PermisosAssignats.GroupDescriptors.Add(descriptor);

I'm using Model/View/ViewModel and N-Layers architecture and I couldn't do a sample because it got too difficult.

While using the 2 GridView without any GroupDescriptor is working perfectly, but, as I use the groupdescriptor stops working.
If I click on the GroupDescriptor then it rebinds and shows all items.

So,....whatz the event triggered when I click the groupdescriptor or...how can i rebind or reorder the content of the GridViews from my viewmodel?? That would probably solve the problem. ( I know, itz just a patch, but it would work, ...i guess).

Or....how can I solve my problem??

Thanks once again.
0
Victor
Top achievements
Rank 1
answered on 03 Dec 2010, 10:52 AM
or....how can I modify the GroupDescriptors of my GridView from my ViewModel??
0
Yavor Georgiev
Telerik team
answered on 06 Dec 2010, 03:08 PM
Hi Victor,

 Could you please outline what steps you take? Do you change RadGridView's ItemsSource object, or do you insert/modity items in the source collection?

Kind regards,
Yavor Georgiev
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
Victor
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Victor
Top achievements
Rank 1
Rossen Hristov
Telerik team
Yavor Georgiev
Telerik team
Share this question
or