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

DataMemberBinding multibinding

5 Answers 2269 Views
GridView
This is a migrated thread and some comments may be shown as answers.
masha reznik
Top achievements
Rank 1
masha reznik asked on 12 Apr 2010, 07:17 PM

Hello,
how i can multi bind a column? I tried the to set multibinding to DataMemeberBinding but i gives me a compilation error

<tel:GridViewColumn.DataMemberBinding> 
     <MultiBinding Converter="{StaticResource PriceByCurrency}" Mode="OneWay">  
            <Binding Path="Price"/>  
            <Binding Path="DefaultCurrency"/>  
      </MultiBinding> 
</tel:GridViewColumn.DataMemberBinding> 

Thanks

5 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 13 Apr 2010, 02:01 PM
Hi masha reznik,


MultiBinding is not supported as column binding. However I am sure we can find a workaround for your scenario.

Instead of binding to two different properties of the underlying object ( e.g. price and currency) , you may bind to the object itself and perform your logic in the IValueConverter.
In fact a very similar scenario is demonstrated in the following blog post. Hope you find it helpful.

Let me know in case you need further assistance.

Greetings,
Pavel Pavlov
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.
0
Christian
Top achievements
Rank 1
answered on 11 Nov 2010, 05:54 PM

Hello,

while searching a result for this problem i tried this solution.

I hope it is helpful for some of you:

<telerik:GridViewDataColumn Header="AHeader" Width="auto" >
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate >
            <TextBlock>
                <TextBlock.Text>
                    <MultiBinding StringFormat=" {0} - {1}">
                        <Binding Path="Price"/>
                        <Binding Path="DefaultCurrency"/>
                    </MultiBinding>
                </TextBlock.Text>
            </TextBlock>
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
0
Pavel Pavlov
Telerik team
answered on 11 Nov 2010, 06:10 PM
Hello Christian,

Thank you for sharing this solution ! Indeed it is perfect for the case where you need just to display data.

By "not supported" I meant the default editing mechanisms ( in the case of two way binding ) of RadGridView will mess up .

Sincerely yours,
Pavel Pavlov
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
0
Alfredo
Top achievements
Rank 1
answered on 08 Sep 2011, 04:37 PM
Hello I tried bindinng to the object itself using a IValueConverter. I Added a column using code:

                GridViewDataColumn columnNotice = new GridViewDataColumn();
                Binding bindingNotice = new Binding(".");  // the object
                bindingNotice.Converter = new NoticeConverter();
                bindingNotice.ConverterParameter = this;
                columnNotice.DataMemberBinding = bindingNotice;
                columnNotice.Header = "Notice";
                columnNotice.ShowDistinctFilters = true;
                columnNotice.ShowFieldFilters = true;
                columnNotice.IsFilterable = true;
                this.mygridview.Columns.Add(columnNotice);

The problem is the column filters not appeared, Although ShowDistinctFilters and ShowFieldFilters are both true

can anyone help me with that?

Thanks
0
Vanya Pavlova
Telerik team
answered on 09 Sep 2011, 11:33 AM
Hi Alfredo,

 

You may take a look at the following forum thread "Column Filter not activated when using converter binding" for further reference. 


Regards,
Vanya Pavlova
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
GridView
Asked by
masha reznik
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Christian
Top achievements
Rank 1
Alfredo
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or