Telerik blogs
  • Desktop WPF

    Empty data template in RadGridView for Silverlight (and WPF)

      One more RadGridView behavior frequently requested by our clients is to display a message when there are no records to display. A typical real life scenario would be a RadGridView displaying a list of search results. When there are no results found we would like to have a message like “No results found!” displayed in RadGridView.       UPDATED VERSION FOR SL4 If you download the project above , you will see that if you get the EmptyDataTemplateBehavior.cs into your project, setting the empty data template will be as easy as writing a few lines of XAML : <telerik:RadGridView x:Name="RadGridView1" > <i:Interaction.Behaviors> <local:EmptyDataTemplateBehavior> <local:EmptyDataTemplateBehavior.EmptyDataTemplate> <DataTemplate> <TextBlock Text="No results...
    February 01, 2010 1 min read
  • Web

    Calculated column in RadGridView for Silverlight + math expressions

    When the data layer does not allow to perform calculations we often need to harness the UI. Here is a a simple case  - in our business object we have the Price and the Count properties. We will have RadGridView to calculate the Total  for us in a calculated column.   Please download this sample project   If you peek into the sample project you will notice we are using a pretty standard Silverlight approach : We bind the value of the calculated column with a Binding Converter : <telerik:GridViewDataColumn Header="Total" Background="Bisque" DataMemberBinding="{Binding Converter={StaticResource CalculatingConverter}}" TextAlignment="Right" />   The calculation “logic” is in the Convert method of CalculatingConverter.cs   public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) ...
    January 28, 2010 2 min read
  • Desktop WinForms

    Cascading ComboBoxes Selection in RadGridView for Silverlight and WPF

      A common scenario when entering data is a cascade of comboboxes, where the list in the next combo is populated after selecting a value in the previous. A typical example is selecting a country from a combo then selecting from a filtered list of cities in a second combo. We have had tons of questions on how this can be done within a row in RadGridVIew so I decided to make a small demo. I have used a nice List of countries by continent.           There are lots of ways to achieve this with RadGridView. Bellow I have tried to demonstrate...
    January 27, 2010 3 min read
  • Web

    Math toolbar for column headers in RadGridView for Silverlight

      A client has recently asked for these little fancy math toolbars in the column header. I found it a great idea and thought it might be useful to share the way of implementing this with RadGridView for Silverlight.   *Since RadGridView for WPF shares the same code base  the approach bellow may be used for both platforms ( Silverlight and WPF ) .   Things are easy with RadGridView !   To have this in your project follow these three easy steps :   1. Copy the MathToolBar user control from the attached sample project (MathToolBar.xaml, MathToolBar.cs). MathToolbarDemo.zip 2. Replace the default header in the column with the user control. <telerik:GridViewDataColumn ... <telerik:GridViewDataColumn.Header> <local:MathToolBar HeaderText="Value1"/> </telerik:GridViewDataColumn.Header> </telerik:GridViewDataColumn>   3. Adjust...
    January 22, 2010 1 min read
  • Web

    How To: Customize RadGridView's Default Filtering Control with Attached Behaviors (Silverlight &amp; WPF)

    If you are familiar with the RadGridView‘s Custom Filtering Functionality you probably know that you can create any kind of user control to replace the default one which looks like this: Very often, however, you may be perfectly happy with the stock filtering control, but you wish you could modify and adapt it just a little bit to match your particular requirements. What should you do then? Maybe build an entirely new filtering control from scratch that looks just like RadGridView’s default one and adds this tiny bit of functionality? No, that would be insane. There is an easier way to do this....
    January 22, 2010 5 min read