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

C# to VB.net coversion issue

2 Answers 106 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.
Timothy
Top achievements
Rank 1
Timothy asked on 01 Nov 2010, 09:58 AM
I found a class on this forum that I need but it is in C# and online conversion tools are not doing the trick to get it converted properly.

Can someone re-write this in VB.net for me?

The line of code that needs to be re-written and cannot be converted with tools properly is in BOLD below.

this.AssociatedObject.RowLoaded +=......

using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Interactivity;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;
using System.Windows.Data;
  
namespace ConditionalCellFormatting
{
    public class ConditionalFormattingBehavior : Behavior<RadGridView>
    {
        protected override void OnAttached()
        {
            base.OnAttached();
            this.AssociatedObject.RowLoaded += new EventHandler<Telerik.Windows.Controls.GridView.RowLoadedEventArgs>(AssociatedObject_RowLoaded);
        }
  
        void AssociatedObject_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
        {
            if ((e.Row is GridViewHeaderRow) || (e.Row is GridViewFooterRow) || (e.Row is GridViewNewRow))
                return; //we want to apply logic to data rows only
  
            Binding colorBinding  = new Binding("Price"){Converter = new PriceToColorConverter()};
            e.Row.Cells[1].SetBinding(GridViewCell.ForegroundProperty, colorBinding);
            //e.Row.Cells[1].SetBinding(GridViewCell.BackgroundProperty, colorBinding);
        }
    }
}

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 01 Nov 2010, 10:44 AM
Hello,

 You can attach the event handler in XAML instead. 

Regards,
Vlad
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
Timothy
Top achievements
Rank 1
answered on 01 Nov 2010, 04:05 PM
Can you provide an example?
Tags
GridView
Asked by
Timothy
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Timothy
Top achievements
Rank 1
Share this question
or