Telerik Forums
UI for WPF Forum
2 answers
201 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
166 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
189 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
81 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
236 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
118 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
113 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
269 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
5 answers
160 views
Is there an example of manually starting a drag via StartDrag?

Here is what I am attempting to do:
Drag files (ie from Windows Explorer, Desktop, etc) to a Telerik control (in this instance a RadTreeListView).

What I already have working:
Dragging within the RadTreeListView is fully implemented

What I have tried:
Register the DragOver event on the RadTreeListView with this code:

if (!RadDragAndDropManager.IsDragging)
            {
                Collection<object> pPayload = new Collection<object>();
                if (e.Data is System.Windows.DataObject && ((System.Windows.DataObject)e.Data).ContainsFileDropList())
                {
                    foreach (string pFilePath in ((System.Windows.DataObject)e.Data).GetFileDropList())
                    {
                        if (File.Exists(pFilePath))
                        {
                            ITrack pTrack = new MediaTrack();
                            pTrack.IsMasterTrack = true;
                            pTrack.Name = Path.GetFileNameWithoutExtension(pFilePath);
                            pTrack.FileName = pFilePath;
                            pPayload.Add(pTrack);
                        }
                    }
                }
                if (pPayload.Count > 0)
                {
                    RadDragAndDropManager.StartDrag(TrackListTreeListView, pPayload, null);
                }
            }
if (!RadDragAndDropManager.IsDragging)
            {
                Collection<object> pPayload = new Collection<object>();
                if (e.Data is System.Windows.DataObject && ((System.Windows.DataObject)e.Data).ContainsFileDropList())
                {
                    foreach (string pFilePath in ((System.Windows.DataObject)e.Data).GetFileDropList())
                    {
                        if (File.Exists(pFilePath))
                        {
                            ITrack pTrack = new MediaTrack();
                            pTrack.IsMasterTrack = true;
                            pTrack.Name = Path.GetFileNameWithoutExtension(pFilePath);
                            pTrack.FileName = pFilePath;
                            pPayload.Add(pTrack);
                        }
                    }
                }
                if (pPayload.Count > 0)
                {
                    RadDragAndDropManager.StartDrag(TrackListTreeListView, pPayload, null);
                }
            }
   if (!RadDragAndDropManager.IsDragging)
        {
            Collection<object> pPayload = new Collection<object>();
            if (e.Data is System.Windows.DataObject && ((System.Windows.DataObject)e.Data).ContainsFileDropList())
            {
                foreach (string pFilePath in ((System.Windows.DataObject)e.Data).GetFileDropList())
                {
                    if (File.Exists(pFilePath))
                    {
                        pPayload.Add(pFilePath);
                    }
                }
            }
            if (pPayload.Count > 0)
            {
                RadDragAndDropManager.StartDrag(TrackListTreeListView, pPayload, null);
            }
        }

The problem is it never starts the drag!  Is there something I am missing?  I would have thought this would have kick-started the Rad Drag and Drop features, but it doesn't seem to do anything.


Travis
if (!RadDragAndDropManager.IsDragging)
            {
                Collection<object> pPayload = new Collection<object>();
                if (e.Data is System.Windows.DataObject && ((System.Windows.DataObject)e.Data).ContainsFileDropList())
                {
                    foreach (string pFilePath in ((System.Windows.DataObject)e.Data).GetFileDropList())
                    {
                        if (File.Exists(pFilePath))
                        {
                            ITrack pTrack = new MediaTrack();
                            pTrack.IsMasterTrack = true;
                            pTrack.Name = Path.GetFileNameWithoutExtension(pFilePath);
                            pTrack.FileName = pFilePath;
                            pPayload.Add(pTrack);
                        }
                    }
                }
                if (pPayload.Count > 0)
                {
                    RadDragAndDropManager.StartDrag(TrackListTreeListView, pPayload, null);
                }
            }
if (!RadDragAndDropManager.IsDragging)
            {
                Collection<object> pPayload = new Collection<object>();
                if (e.Data is System.Windows.DataObject && ((System.Windows.DataObject)e.Data).ContainsFileDropList())
                {
                    foreach (string pFilePath in ((System.Windows.DataObject)e.Data).GetFileDropList())
                    {
                        if (File.Exists(pFilePath))
                        {
                            ITrack pTrack = new MediaTrack();
                            pTrack.IsMasterTrack = true;
                            pTrack.Name = Path.GetFileNameWithoutExtension(pFilePath);
                            pTrack.FileName = pFilePath;
                            pPayload.Add(pTrack);
                        }
                    }
                }
                if (pPayload.Count > 0)
                {
                    RadDragAndDropManager.StartDrag(TrackListTreeListView, pPayload, null);
                }
            }
if (!RadDragAndDropManager.IsDragging)
            {
                Collection<object> pPayload = new Collection<object>();
                if (e.Data is System.Windows.DataObject && ((System.Windows.DataObject)e.Data).ContainsFileDropList())
                {
                    foreach (string pFilePath in ((System.Windows.DataObject)e.Data).GetFileDropList())
                    {
                        if (File.Exists(pFilePath))
                        {
                            ITrack pTrack = new MediaTrack();
                            pTrack.IsMasterTrack = true;
                            pTrack.Name = Path.GetFileNameWithoutExtension(pFilePath);
                            pTrack.FileName = pFilePath;
                            pPayload.Add(pTrack);
                        }
                    }
                }
                if (pPayload.Count > 0)
                {
                    RadDragAndDropManager.StartDrag(TrackListTreeListView, pPayload, null);
                }
            }
if (!RadDragAndDropManager.IsDragging)
            {
                Collection<object> pPayload = new Collection<object>();
                if (e.Data is System.Windows.DataObject && ((System.Windows.DataObject)e.Data).ContainsFileDropList())
                {
                    foreach (string pFilePath in ((System.Windows.DataObject)e.Data).GetFileDropList())
                    {
                        if (File.Exists(pFilePath))
                        {
                            ITrack pTrack = new MediaTrack();
                            pTrack.IsMasterTrack = true;
                            pTrack.Name = Path.GetFileNameWithoutExtension(pFilePath);
                            pTrack.FileName = pFilePath;
                            pPayload.Add(pTrack);
                        }
                    }
                }
                if (pPayload.Count > 0)
                {
                    RadDragAndDropManager.StartDrag(TrackListTreeListView, pPayload, null);
                }
            }
if (!RadDragAndDropManager.IsDragging)
            {
                Collection<object> pPayload = new Collection<object>();
                if (e.Data is System.Windows.DataObject && ((System.Windows.DataObject)e.Data).ContainsFileDropList())
                {
                    foreach (string pFilePath in ((System.Windows.DataObject)e.Data).GetFileDropList())
                    {
                        if (File.Exists(pFilePath))
                        {
                            ITrack pTrack = new MediaTrack();
                            pTrack.IsMasterTrack = true;
                            pTrack.Name = Path.GetFileNameWithoutExtension(pFilePath);
                            pTrack.FileName = pFilePath;
                            pPayload.Add(pTrack);
                        }
                    }
                }
                if (pPayload.Count > 0)
                {
                    RadDragAndDropManager.StartDrag(TrackListTreeListView, pPayload, null);
                }
            
Tsvyatko
Telerik team
 answered on 11 Dec 2010
1 answer
142 views
Hi
I am using Windows XP.I want to change the blue color around my customized window used as a message box.I want that blue color to be replaced by some glassy color as it is in vista or windows 7.please help me out in changing that blue color around it  as soon as possible.
George
Telerik team
 answered on 11 Dec 2010
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
VirtualKeyboard
HighlightTextBlock
Security
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?