Telerik Forums
UI for WPF Forum
1 answer
101 views
When I try to filter my source by a datetime field, I get the default date picker. I enter a date or select from the calendar but my result grid doesn't show the records that correspond with that date. Could it be because the editor is looking at the date only and my underlying value has both date & time? How do I get around this if this is in fact the issue?
Rossen Hristov
Telerik team
 answered on 10 Feb 2012
4 answers
112 views
Hi,

I would like to be able to set which fields are available for datafiltering on the RadDataFilter. As i understand, this can be done using annotations. However i find the use of annotations cumbersome. I use the RadDataFilter to filter data in a RadGridView. The  RadGridView is boud to a collection in the Viewmodel. Now in order to specify which fields are available for datafiletring, i would have to annotate the public fields of my viewmodel. I think this is a violation of seperation of View and Viewmodel. Moreover,  if i have diferent views using the same viewmodel with a RadDataFilter and i wish to have different fields available for filtering in each view, then this cannot be done.

In my honest opnion, which fields can be filtered, and what their caption is in the RadDataFilter should be specified in a collection of the RadDataFilter itself (much as the columns collection in the RadGridView).

If you think i going the wrong way here please let me know.

Kind regards,
Ronald Steenbergen
Rossen Hristov
Telerik team
 answered on 10 Feb 2012
1 answer
134 views
Hi,

I am using a DropDownbutton with a RadContextmenu. When using Accesskey on the RibbonView/DropDownbutton/RadContextmenu. De access keys don't show on the submenu of the RadContextmenu. A made a sample to demonstrate this:

<Window x:Class="WpfRibbonMenuKeys.MainWindow"
        Title="MainWindow" Height="350" Width="525" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
    <Grid>
        <telerik:RadRibbonView Name="radRibbonView1" VerticalAlignment="Top" telerik:KeyTipService.IsKeyTipsEnabled="True">
            <telerik:RadRibbonTab Header="RibbonTab"  telerik:KeyTipService.AccessText="H">
                <telerik:RadRibbonGroup Header="SomeGroup" telerik:ScreenTip.Title="SomeGroup" DialogLauncherVisibility="Collapsed" >
                    <telerik:RadRibbonDropDownButton Text="DropDown"
                                                     Size="Large"
                                                     telerik:KeyTipService.AccessText="S">
                        <telerik:RadRibbonDropDownButton.DropDownContent>
                            <telerik:RadContextMenu >
                                <telerik:RadMenuItem Header="Test1" telerik:KeyTipService.AccessText="1"/>
                                <telerik:RadMenuItem Header="Test2" telerik:KeyTipService.AccessText="2">
                                    <telerik:RadMenuItem Header="Test2.1" telerik:KeyTipService.AccessText="21"/>
                                    <telerik:RadMenuItem Header="Test2.2" telerik:KeyTipService.AccessText="22"/>
                                    <telerik:RadMenuItem Header="Test2.3" telerik:KeyTipService.AccessText="23"/>
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem Header="Test3" telerik:KeyTipService.AccessText="3"/>
                            </telerik:RadContextMenu>
                        </telerik:RadRibbonDropDownButton.DropDownContent>
                    </telerik:RadRibbonDropDownButton>
                </telerik:RadRibbonGroup>
            </telerik:RadRibbonTab>
        </telerik:RadRibbonView>
    </Grid>
</Window>

The menuitems Test2.1, Test 2.2 and Test 2.3 don't show access keys. Also when having used access keys, it is not possible to use the arrow keys to navigate through the contextmenu. So when using Alt-H-S-2, in the sample, the submenu is opened, but further keyhandling is not respected.

Regards,
Ronald
Tina Stancheva
Telerik team
 answered on 10 Feb 2012
0 answers
150 views
Hi Team,
How I will diable a control placed in GridViewDataColumn cell template programmatically so that content inside CellTemplate become disable.
I need all this functionality when gridview render.

when i use GridViewColumn.IsEnabled= false; It doesn't disable button placed inside DataTemplate.



<telerik:GridViewDataColumn x:Name="clmDelete" Width="30" Header="" HeaderTextAlignment="Center" >
  <telerik:GridViewDataColumn.CellTemplate>
    <DataTemplate>
      <my1:Button x:Name="btnDelete" BorderThickness="0" Background="White"
     Click="btnDelete_Click"  HorizontalAlignment="Left" Grid.Column="0"  Width="20" Height="20">
     <Image Source="/UI.SmartClient;component/~or83E_files/delete16.ico" Width="Auto" />
     </my1:Button>
    </DataTemplate>
 </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn >

foreach (Telerik.Windows.Controls.GridViewColumn column in gv.Columns)
{
       column.isEnabled=false; 
}


Kamran
Top achievements
Rank 3
Iron
Iron
Veteran
 asked on 10 Feb 2012
1 answer
85 views
I there a way to only allow the scheduleView to display by date, ie don't show time slots on the scheduler?  All views should only display by date, ie no time slots
Yana
Telerik team
 answered on 10 Feb 2012
1 answer
63 views
Hi,

I have a grid with all default settings related with Sorting. 
grid's ItemSource property is set to custom List<MyCalss> at run time. 
But when i click on column's header for sorting it clears grid data.


Thanks,
Bala
Bhalchandra
Top achievements
Rank 1
 answered on 10 Feb 2012
2 answers
129 views
I am using a RadGridView whose ItemsSource is bound to a DataTable.
 The reason for using DataTable is because the columns have to be generated dynamically based on user's selection.
 I've added Aggregate Functions to each columns and recalculate them when the data source changes.
 The RadGridView throws exceptions on certain conditions.
 
I've attached a sample application that reproduces the error.
 the application is contrived from the original application to include only the necessary part.
 (The original application uses MVVM pattern, and the recalculation of aggregates happens when the ItemsSource in the ViewModel changes.)
 there are 2 different errors that I've encountered so far.
 
here are the steps to reproduce the error.
 Error A
 1. set the 'number of data columns' at the top right corner to 2(default), click the 'Load' button 3 times.
 2. at the 3rd click, Telerik.Windows.Controls.GridView.GridViewFooterCell.AggregateResults_CollectionChanged throws exception.
 
Error B
 1. set 'Add Count Function to Time column' to true, 'number of data columns' to 2, then click the 'Load' button
 2. set 'number of data columns' to 1, then click the 'Load' button twice.
 3. at the 2nd click of Step 2, RadGridView.CalculateAggregates() throws exception.
 
hope you look into this error,
 and if you have a better solution on what I'm trying to achieve(dynamic column generation, calculate aggregates),
 please do suggest.
 
Thanks.

I've discovered that you can't attach solution files in this forum, so I'll put the code below.

Main.xaml
<Window x:Class="RadGridViewAggregateFunctionTest.MainView"
        Title="MainWindow" Height="350" Width="600">
    <Grid x:Name="grid">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="number of data columns : " VerticalAlignment="Center"/>
            <telerik:RadNumericUpDown x:Name="radNumericUpDown" IsInteger="True" ValueChanged="radNumericUpDown_ValueChanged"
                                      Value="2"/>
            <CheckBox Content="Add Count Function at Time column" VerticalAlignment="Center" Margin="20,0,0,0" Checked="CheckBox_Checked" />
            <Button x:Name="LoadButton" Grid.Row="0" Width="100"
                    Content="Load"
                    Margin="20,0,0,0" Click="LoadButton_Click"
                    />
        </StackPanel>
        <telerik:RadGridView x:Name="radGridView" Grid.Row="1" ItemsSource="{Binding}"
                             ShowColumnFooters="True" ShowGroupPanel="False">
        </telerik:RadGridView>
    </Grid>
</Window>


Main.xaml.cs
using System;
using System.Linq;
using System.Data;
using System.Windows;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using System.IO;
using System.Windows.Controls;
 
namespace RadGridViewAggregateFunctionTest
{
    public partial class MainView : Window
    {
        Random random = new Random();
        private const int TIME_COLUMN_INDEX = 0;
        int numberOfColumns = 0;
        bool shouldAddCountFunctionAtTimeColumn = false;
 
        public MainView()
        {
            InitializeComponent();
        }
 
        private void LoadButton_Click(object sender, RoutedEventArgs e)
        {
            radGridView.DataContext = GenerateTable();
             
            AddAggregateFunctions(radGridView);
        }
 
        private void AddAggregateFunctions(RadGridView gridView)
        {
            foreach (var column in gridView.Columns)
            {
                if (column.DisplayIndex == TIME_COLUMN_INDEX)
                {
                    if (shouldAddCountFunctionAtTimeColumn)
                    {
                        CountFunction countFunction = new CountFunction();
                        countFunction.Caption = "Count : ";
                        column.AggregateFunctions.Add(countFunction);
                    }
 
                    continue;
                }
 
                MinFunction minFunction = new MinFunction();
                minFunction.Caption = "Min : ";
                column.AggregateFunctions.Add(minFunction);
 
                MaxFunction maxFunction = new MaxFunction();
                maxFunction.Caption = "Max : ";
                column.AggregateFunctions.Add(maxFunction);
 
                AverageFunction averageFunction = new AverageFunction();
                averageFunction.Caption = "Average : ";
                column.AggregateFunctions.Add(averageFunction);
            }
 
            gridView.CalculateAggregates();
        }
 
        private DataTable GenerateTable()
        {
            DataTable table = new DataTable("My Table");
 
            GenerateColumns(table);
 
            GenerateRows(table);
 
            return table;
        }
 
        private void GenerateColumns(DataTable table)
        {
            DataColumn column = new DataColumn("Time", typeof(DateTime));
            table.Columns.Add(column);
 
            for (int i = 0; i < numberOfColumns; i++)
            {
                string columnName = Path.GetRandomFileName().Substring(0, 4);
                column = new DataColumn(columnName, typeof(float));
                table.Columns.Add(column);
            }
        }
 
        private void GenerateRows(DataTable table)
        {
            DataRow row;
 
            for (int i = 0; i < 20; i++)
            {
                row = table.NewRow();
 
                row["Time"] = DateTime.Now.AddSeconds(i);
 
                foreach (DataColumn column in table.Columns)
                {
                    if (column.ColumnName == "Time")
                    {
                        continue;
                    }
 
                    row[column.ColumnName] = (float)random.NextDouble() * 50;
                }
 
                table.Rows.Add(row);
            }
        }
 
        private void radNumericUpDown_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e)
        {
            Int32.TryParse(radNumericUpDown.Value.ToString(), out numberOfColumns);
        }
 
        private void CheckBox_Checked(object sender, RoutedEventArgs e)
        {
            shouldAddCountFunctionAtTimeColumn = ((CheckBox)sender).IsChecked.Value;
        }
    }
}

SPE
Top achievements
Rank 1
 answered on 10 Feb 2012
2 answers
157 views
We are facing a problem with a WPF application which is excessively using Telerik Controls. One of our customers is not able to see any Telerik UI controls in the application.

Any ideas on this?
Mike
Top achievements
Rank 1
 answered on 09 Feb 2012
6 answers
265 views
I am using RadWindows in place of MessageBoxes in my application.  However, the RadWindow.Alert windows activated when they are shown.  In other words when they are shown I assume that I can press the Enter key and close them but this is not the case.  However if I click on the window and then press the Enter key the window is closed.

The RadWindow.Prompt does not seem to have this same issue however I am not setting any property specially on either.

I have tried using the Opened property to set focus on the RadWindow and the RadAlert but that shows an undesirable adorner around the element.  I would be fine with doing this on the button however it does not seem to appear in the visual tree.  There also appears to be no Activate method for the RadWindow nor is there a ShowActivated property.  I'm out of options at this point.  Is this a defect that should be logged?  Please advise.
Adam
Top achievements
Rank 1
 answered on 09 Feb 2012
2 answers
174 views
Currently I have 

 <telerik:GridViewDataColumn Header="{x:Static resources:Strings.XXXXXXXXXXXX}"
                                                IsFilterable="True"
                                                IsSortable="True"
                                                DataMemberBinding="{Binding Path=XXXXXXXXXXXXXXXX}"
                                                CellTemplate="{StaticResource XXXXXXXXXXXXX}" />

But I observe repeat values in the filter since the column contains repeat values.  How can I avoid this and make sure the filter contains only the unique values?  I am using MVVM.

Thanks
Gautam
Top achievements
Rank 1
 answered on 09 Feb 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?