Telerik Forums
UI for WPF Forum
5 answers
126 views
Hi,

I'd like to set my custom filter in datagrid with some values without opening filter pop-up.

As far as I understand for that purpose I have to call somehow method Prepare(GridViewBoundColumnBase gridViewColumn) of my filter to initialize my filter.

Can you please tell me or better show me, how can I clever handle such situation.

Thank u in advance,
Julian 
Veselin Vasilev
Telerik team
 answered on 13 Dec 2010
1 answer
271 views
Suppose you have the following definitions:
 
public enum Category { Spicy, Fat, Tasty, Expensive};
  
public class Dish
{
    public string Name {get; set;}
    public Category[] Categories {get; set;}
}

I show a collection of Dish objects in a RadGridView. As property Categories is a collection I concatenate the values into a single string, e.g. "Spicy, Fat". Now I would like to add some custom filtering behavior that makes it possible to this on the Categories column:
  • Show a sorted list of all the values in the Category enum (or perhaps only the values that are used by the Dish objects in the grid)
  • Use a CheckedList so that more than one value can be selected.
  • When more than one Category is used in the filter I want to see all items having at least one of the grades (i.e. an OR condition).
Example:
Grid content [Name: Categories]
- Filet Mignon: Expensive, Fat
- Sausage: Fat
- Thai Curry: Spicy, Tasty
 
If I select values Fat and Expensive I should see the rows for FiletMignon (matches both) and Sausage (matches Fat).
If I select values Spicy and Expensive I should see the rows for FiletMignon (matches Expensive) and ThaiCurry (matches Spicy).

I would be more than grateful for some help on this so thanks in advance!
 
Rossen Hristov
Telerik team
 answered on 13 Dec 2010
2 answers
196 views
Hi telerik Team

It seems that DataAnnotations don't work in RadControls_for_WPF35_2010_3_1110_Trial.

I build a Testclass and set it as ItemSource on GridView but except DisplayName all attributes are ignored.

public class Test
{
    [Display(AutoGenerateField = false)]
    [RangeAttribute(1, 10)]
    public int Id { get; set; }
 
    [DisplayName("TestNumber")]
    [Display(Order = 1)]
    [Required(AllowEmptyStrings = false, ErrorMessage = "Exception")]
    public string Number { get; set; }
 
    [Display(Order = 0)]
    [Required(AllowEmptyStrings = false, ErrorMessage = "Exception")]
    public string Name { get; set; }
}

List<Test> testList = new List<Test>();
 
Test test = null;
for (int i = 0; i < 10; i++)
{
    test = new Test();
    test.Id = i;
    test.Name = "Name" + i.ToString();
    test.Number = i.ToString();
    testList.Add(test);
}
 
radGridView.ItemsSource = testList;

Your artikel here say it should work:
http://www.telerik.com/help/wpf/gridview-prevent-column-autogenerate.html
http://www.telerik.com/products/wpf/gridview.aspx#built-in-data-validation

What i'm doing wrong?

PS: I also try 00968RadControls_for_WPF_40_2010_3_1206_TRIAL_hotfix

PPS: It would great if user could add Sample VS Project to posts, not just images.
Matthias
Top achievements
Rank 1
 answered on 13 Dec 2010
1 answer
161 views
Expression_Dark theme is only for RadTabControl. Anyway to apply it to normal TabControl? (Can't use RadTabControl due to its buggy behvior in PRISM as a region).

Following in the markup doesn't work because there is no key defined in Expression_Dark theme for normal tabcontrol

<Style TargetType="{x:Type TabControl}" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:Expression_DarkTheme, ElementType=TabControl}}" />
Dimitrina
Telerik team
 answered on 13 Dec 2010
3 answers
182 views
How do you print the Schedule view?
I don't want to print the actual screen ( using PrintVisual), but print the entire view?
Rosi
Telerik team
 answered on 13 Dec 2010
1 answer
80 views
Hi

We are creating an Lineseries chart with datapoints which has around 70000+ records .It is taking more than 30 minutes to load the chart .we have disable the animations to false(ChartArea.EnableAnimations = false) and also SamplingSettings.SamplingThreshold = 0. so please help us.The code we are using are as below

 

 

private void BuildDiskIoDetailsGraph(ObservableCollection<DiskIoDetails> raw, Telerik.Windows.Controls.RadChart ctrlChart, string title, bool isPrefetch)

 

{

 

 

if (raw.Count > 0)

 

{

 

 

DataSeries chartSeries = new DataSeries();

 

chartSeries.Definition =

 

new LineSeriesDefinition() { ShowItemLabels = false, ShowItemToolTips = true };

 

ctrlChart.SamplingSettings.SamplingThreshold = 0;

ctrlChart.DefaultView.ChartArea.EnableAnimations =

 

false;

 

ctrlChart.DefaultView.ChartLegend.Visibility =

 

Visibility.Collapsed;

 

ctrlChart.DefaultView.ChartLegend.UseAutoGeneratedItems =

 

true;

 

ctrlChart.DefaultView.ChartArea.AxisX.Step = 20f;

ctrlChart.DefaultView.ChartArea.AxisX.AutoRange =

 

true;

 

ctrlChart.DefaultView.ChartArea.AxisX.Title =

 

"Time";

 

 

 

 

List<object> processList = raw.Select(d => d.GetType().InvokeMember("ProcessNamePID", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, d, null)).Distinct().ToList();

 

 

 

foreach (object process in processList)

 

{

 

 

Color color = GetNextColor();

 

 

 

if (process.ToString().ToLower().StartsWith("system")) color = Colors.Blue;

 

 

 

if (process.ToString().ToLower().StartsWith("winlogon")) color = Colors.Maroon;

 

 

 

if (process.ToString().ToLower().StartsWith("idle")) color = Colors.Green;

 

 

chartSeries.Definition.Appearance.Foreground =

 

new SolidColorBrush(color);

 

chartSeries.Definition.Appearance.Fill =

 

new SolidColorBrush(color);

 

chartSeries.Definition.Appearance.PointMark.Fill =

 

new SolidColorBrush(color);

 

chartSeries.Definition.Appearance.Stroke =

 

new SolidColorBrush(Colors.LightGray);

 

 

chartSeries.Definition.Appearance.PointMark.Stroke =

 

new SolidColorBrush(color);

 

 

 

List<DiskIoDetails> dataList = raw.Where(d => d.GetType().InvokeMember("ProcessNamePID", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, d, null).ToString().Equals(process.ToString())).ToList();

 

 

 

foreach (object item in dataList)

 

{

 

 

string startTime = item.GetType().InvokeMember("StartTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, item, null).ToString();

 

 

 

string offset = item.GetType().InvokeMember("ByteOffset", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, item, null).ToString().TrimStart("0x".ToCharArray());

 

 

 

string ioType = item.GetType().InvokeMember("IOType", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, item, null).ToString();

 

 

 

string endTime = item.GetType().InvokeMember("EndTime", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, item, null).ToString();

 

 

 

string processName = item.GetType().InvokeMember("ProcessNamePID", BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty, null, item, null).ToString();

 

 

 

if (ioType.ToLower().Contains("read")) ioType = "Read";

 

 

 

else ioType = "Write";

 

 

 

if (string.IsNullOrEmpty(offset)) offset = "0";

 

 

 

if (chartSeries != null)

 

{

 

 

double initTime = Convert.ToDouble(startTime) / _nsPerSec;

 

 

 

double complete = Convert.ToDouble(endTime) / _nsPerSec;

 

 

 

 

DataPoint dp = new DataPoint( (Convert.ToDouble(startTime) / _nsPerSec),long.Parse(offset, System.Globalization.NumberStyles.HexNumber));

 

dp.Tooltip =

 

string.Format("{0}{1}InitTime: {2}{1}Complete Time: {3}{1}{4}", ioType, Environment.NewLine, initTime, complete, processName);

 

 

chartSeries.Add(dp);

 

 

//m_Line.Interactivity.Tooltips.Add(string.Format("{0}{1}InitTime: {2}{1}Complete Time: {3}{1}{4}", ioType, Environment.NewLine, initTime, complete, processName));

 

 

 

 

 

 

}

}

}

ctrlChart.DefaultView.ChartArea.DataSeries.Add(chartSeries);

 

 

}

}

 

 

Yavor
Telerik team
 answered on 13 Dec 2010
8 answers
232 views
Hello, I am using LINQ to SQL class in order to retrieve and write data in my SQL. I have a table called Student and Subjects. Student is my parent table and Subjects is my child table. I successfully displays per student his/her subjects with Hierarchical Data Grid. I can add, delete, update, read data in my Subjects using the Property CanUserInsertRows and ShowInsertRow as true. Now my problem is that when I want to add new item in my Student table I cannot click my add new item or it is not clickable. Any help please?
Here's my xaml file
<Window x:Class="HierarchiyGridSuccess.MainWindow"
        xmlns:telerikData="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <telerik:RadGridView Grid.Row="0" x:Name="rgvData" ShowInsertRow="True" AutoGenerateColumns="False" telerik:Theming.Theme="Windows7" ItemsSource="{Binding}" >
            <telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition />
            </telerik:RadGridView.ChildTableDefinitions>
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding StudentID}" Header="Student ID" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding StudentFN}" Header="Student First Name" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding StudentLN}" Header="Student Last Name" />
            </telerik:RadGridView.Columns>
            <telerik:RadGridView.HierarchyChildTemplate>
                <DataTemplate>
                    <telerik:RadGridView x:Name="RadGridView1" Loaded="rgvData_Loaded" AutoGenerateColumns="False" ShowInsertRow="False"  CanUserInsertRows="False"  ItemsSource="{Binding Subjects}" ShowGroupPanel="False" IsReadOnly="False">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding SubjectName}" Header="Subject Name" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding SubjectProf}" Header="Professor" />
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </DataTemplate>
            </telerik:RadGridView.HierarchyChildTemplate>
        </telerik:RadGridView>
        <Button Content="Save!" Width="Auto" Height="Auto" Grid.Row="1" Click="Button_Click" />  
    </Grid>
</Window>

And my class file 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.Specialized;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;
 
namespace HierarchiyGridSuccess
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        DataAccessDataContext m_dcData;
        public MainWindow()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
 
            this.rgvData.Items.CollectionChanged += new NotifyCollectionChangedEventHandler(Items_CollectionChanged);
            rgvData.Filtered += new EventHandler<Telerik.Windows.Controls.GridView.GridViewFilteredEventArgs>(rgvData_Filtered);
        }
 
        void rgvData_Loaded(object sender, RoutedEventArgs e)
        {
            var childGrid = (RadGridView)sender;
        var parentRow = childGrid.ParentRow;   
 
        if (parentRow != null)
        {
            rgvData.SelectedItem = childGrid.DataContext;
            parentRow.IsExpandedChanged += new RoutedEventHandler(parentRow_IsExpandedChanged);
        }
         }
 
    void parentRow_IsExpandedChanged(object sender, RoutedEventArgs e)
    {
        rgvData.SelectedItem = ((GridViewRow)sender).DataContext;
    }
         
 
        void rgvData_Filtered(object sender, Telerik.Windows.Controls.GridView.GridViewFilteredEventArgs e)
        {
            rgvData.ItemsSource = m_dcData.Students;
        }
 
        private void Items_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            try
            {
                if (e.Action == NotifyCollectionChangedAction.Add)
                {
                    foreach (Student item in e.NewItems)
                    {
                        this.m_dcData.Students.InsertAllOnSubmit(e.NewItems.OfType<Student>());
                    }
                }
                if (e.Action == NotifyCollectionChangedAction.Remove)
                {
                    this.m_dcData.Students.DeleteAllOnSubmit(e.OldItems.OfType<Student>());
                }
            }
            catch (Exception s)
            { }
        }
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            m_dcData = new DataAccessDataContext();
            m_dcData.Log = Console.Out;
            DataContext = m_dcData.Students;
            rgvData.ShowInsertRow = true;
        }
 
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var changes = this.m_dcData.GetChangeSet();
            rgvData.BeginInsert();
            MessageBox.Show(string.Format("There are {0} inserts and {1} deletes pending.", changes.Inserts.Count, changes.Deletes.Count));
            m_dcData.SubmitChanges();
        }
    }
}

How come I cannot click the add new item of my parent table?
Leo
Top achievements
Rank 2
 answered on 11 Dec 2010
1 answer
113 views
I have set IsItemsAnimationEnabled to false.
As expected, this does prevent animation when I drag and swap one item with another.

I am changing MinimizedItemsPosition when the user clicks a button.  The minimized items move to the newly specified position, but the movement is animated.
Is this the desired behavior?

My controls do not animate well, so I am trying to avoid these animations.
Buzz
Zarko
Telerik team
 answered on 11 Dec 2010
1 answer
110 views
Hi,

I just want to mention that you should review the filter dropdown template.
Because when I want to hide Distinct Filters I also loose the close button with it.
I know this is because "ShowDistinctFilters" hides the "top part" of the dropdown.

But if I want (which I do often) hide distinct filters I loos this (important) button.
Of course I could generate my own template - but this should be "in the box".

Manfred
Vanya Pavlova
Telerik team
 answered on 11 Dec 2010
10 answers
262 views
sorry the table structure is not good.so i create one more thread.
Hi telerik team,
                       I am sivakanth. we are using ur telerik rad controls in our latest WPF project.
I want to create following table structure inside rad gridview.

Enter Name

Text Box

Department

Combo box

Gender

Radio button

Save

Button



 Is it possible to create inside radgrid view ?

if possible mean give me some coding guidlines.

if not posible mean than which control i used  to create these  structure.

thank you.


sivakanth
Top achievements
Rank 1
 answered on 11 Dec 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?