Telerik Forums
UI for WPF Forum
1 answer
123 views
How long before we have a new Roadmap?  I'm currently evaluating different WPF components and need to know the future direction before I make a final decision.
Valeri Hristov
Telerik team
 answered on 28 Apr 2009
5 answers
465 views
I borrowed the code from the C# Examples and modified it to show the issue as well as another problem I've addressed in a separate posting.  Notice that changing the resource dictionary that is merged using the buttons at the top does not effect the display of the gridview as expected.  The other elements on the page do change, and if the alternate dictionary is loaded at the start it changes, but the buttons do not effect the grid.  What gives?

<Window x:Class="ThemeIssue.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 
    xmlns:GridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView" 
    Title="Dynamic Resource Troubles">  
<Grid> 
        <Grid.RowDefinitions> 
            <RowDefinition Height="50" /> 
            <RowDefinition /> 
        </Grid.RowDefinitions> 
        <StackPanel Grid.Row="0" Margin="5" 
                    Orientation="Horizontal"   
                    Background="{DynamicResource ColorOne}" 
                    HorizontalAlignment="Center">  
            <TextBlock Name="TextBlock1"   
                       Margin="5" 
                       VerticalAlignment="Center" 
                       Background="{DynamicResource ColorTwo}" 
                       Foreground="{DynamicResource ColorOne}" /> 
            <Button Content="Light" Click="butLight_Click" Margin="5"/>  
            <Button Content="Dark" Click="butDark_Click" Margin="5"/>  
        </StackPanel> 
     
        <telerik:RadGridView Name="RadGridView1" DataLoadMode="Asynchronous" Grid.Row="1" ColumnsWidthMode="Auto" 
                   IsReadOnly="True" AutoGenerateColumns="False">  
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn   
                    HeaderText="ID"   
                    Background="{DynamicResource ColorTwo}" 
                    DataMemberPath="ID" /> 
                <telerik:GridViewDataColumn   
                    Width="*"   
                    HeaderText="Name"   
                    Background="{DynamicResource ColorOne}" 
                    DataMemberPath="Name" /> 
                <telerik:GridViewDataColumn   
                    DataFormatString="{}{0:c2}"   
                    HeaderText="UnitPrice"   
                    Background="{DynamicResource ColorThree}" 
                    DataMemberPath="UnitPrice" /> 
                <telerik:GridViewDataColumn   
                    DataFormatString="{}{0:d}"   
                    HeaderText="Date"   
                    Background="{DynamicResource ColorFour}" 
                    DataMemberPath="Date" /> 
                <telerik:GridViewDataColumn HeaderText="Discontinued" DataMemberPath="Discontinued">  
                    <telerik:GridViewDataColumn.CellStyle> 
                        <Style TargetType="GridView:GridViewCell">  
                            <Setter Property="Template">  
                                <Setter.Value> 
                                    <ControlTemplate TargetType="GridView:GridViewCell">  
                                        <Border BorderThickness="{TemplateBinding BorderThickness}"   
                                            BorderBrush="{TemplateBinding BorderBrush}"   
                                            Background="{TemplateBinding Background}">  
                                            <CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" 
                                                  IsChecked="{Binding Discontinued}" IsEnabled="False" /> 
                                        </Border> 
                                    </ControlTemplate> 
                                </Setter.Value> 
                            </Setter> 
                        </Style> 
                    </telerik:GridViewDataColumn.CellStyle> 
                </telerik:GridViewDataColumn> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 
    </Grid> 
</Window> 
 

using System;  
using System.Collections.Generic;  
using System.ComponentModel;  
using System.Linq;  
using System.Windows;  
using System.Windows.Media;  
 
namespace ThemeIssue  
{  
    /// <summary> 
    /// Interaction logic for Window1.xaml  
    /// </summary> 
    public partial class Window1  
    {  
        private DateTime start;  
        private ResourceDictionary lightColors = new ResourceDictionary();  
        private ResourceDictionary darkColors = new ResourceDictionary();  
 
        public Window1()  
        {  
            CreateResourceDictionaries();  
            Resources.MergedDictionaries.Add(lightColors);  
 
            InitializeComponent();  
 
            start = DateTime.Now;  
 
            Loaded += Example_Loaded;  
 
            RadGridView1.DataLoaded += RadGridView1_DataLoaded;  
            RadGridView1.SortDescriptions.PropertyChanged += ResetTime;  
            RadGridView1.GroupDescriptions.PropertyChanged += ResetTime;  
        }  
 
        private void CreateResourceDictionaries()  
        {  
            var light = new SolidColorBrush(Colors.Yellow);  
            var dark = new SolidColorBrush(Colors.Green);  
            var lightAlpha = new SolidColorBrush(ModifyAlpha(light, 50));  
            var darkAlpha = new SolidColorBrush(ModifyAlpha(dark, 50));  
 
            lightColors.Add("ColorOne", dark);  
            lightColors.Add("ColorTwo", light);  
            lightColors.Add("ColorThree", darkAlpha);  
            lightColors.Add("ColorFour", lightAlpha);  
 
            darkColors.Add("ColorOne", light);  
            darkColors.Add("ColorTwo", dark);  
            darkColors.Add("ColorThree", lightAlpha);  
            darkColors.Add("ColorFour", darkAlpha);  
        }  
 
        private Color ModifyAlpha(SolidColorBrush light, byte alpha)  
        {  
            Color lightlightModified = light.Color;  
            lightModified.A = alpha;  
            return lightModified;  
        }  
 
        private void ResetTime(object sender, PropertyChangedEventArgs e)  
        {  
            start = DateTime.Now;  
        }  
 
        private void Example_Loaded(object sender, RoutedEventArgs e)  
        {  
            RadGridView1.ItemsSource = new MyBusinessObjects().GetData(100);  
        }  
 
        private void RadGridView1_DataLoaded(object sender, EventArgs e)  
        {  
            RadGridView1.FilterDescription.PropertyChanged += FilterDescription_PropertyChanged;  
            TextBlock1.Text = String.Format("Total time to load data: {0} ms",  
                                            Math.Round((DateTime.Now - start).TotalMilliseconds));  
        }  
 
        private void FilterDescription_PropertyChanged(object sender, PropertyChangedEventArgs e)  
        {  
            RadGridView1.FilterDescription.PropertyChanged -= FilterDescription_PropertyChanged;  
            ResetTime(sender, e);  
        }  
 
        private void butLight_Click(object sender, RoutedEventArgs e)  
        {  
            Resources.MergedDictionaries.Clear();  
            Resources.MergedDictionaries.Add(lightColors);  
        }  
 
        private void butDark_Click(object sender, RoutedEventArgs e)  
        {  
            Resources.MergedDictionaries.Clear();  
            Resources.MergedDictionaries.Add(darkColors);  
        }  
    }  
 
    public class MyBusinessObjects  
    {  
        private string[] names = new string[]  
                                     {  
                                         "Côte de Blaye", "Boston Crab Meat",  
                                         "Singaporean Hokkien Fried Mee", "Gula Malacca", "Rogede sild",  
                                         "Spegesild", "Zaanse koeken", "Chocolade", "Maxilaku", "Valkoinen suklaa"  
                                     };  
 
        private double[] prizes = new double[]  
                                      {  
                                          23.2500, 9.0000, 45.6000, 32.0000,  
                                          14.0000, 19.0000, 263.5000, 18.4000, 3.0000, 14.0000  
                                      };  
 
        private DateTime[] dates = new DateTime[]  
                                       {  
                                           new DateTime(2007, 5, 10), new DateTime(2008, 9, 13),  
                                           new DateTime(2008, 2, 22), new DateTime(2009, 1, 2),  
                                           new DateTime(2007, 4, 13),  
                                           new DateTime(2008, 5, 12), new DateTime(2008, 1, 19),  
                                           new DateTime(2008, 8, 26),  
                                           new DateTime(2008, 7, 31), new DateTime(2007, 7, 16)  
                                       };  
 
        private bool[] bools = new bool[] {true, false, true, false, true, false, true, false, true, false};  
 
        public IEnumerable<MyBusinessObject> GetData(int maxItems)  
        {  
            var rnd = new Random();  
 
            return from i in Enumerable.Range(0, maxItems)  
                   select new MyBusinessObject(i, names[rnd.Next(9)], prizes[rnd.Next(9)],  
                                               dates[rnd.Next(9)], bools[rnd.Next(9)]);  
        }  
 
        public class MyBusinessObject  
        {  
            private int id;  
            private string name;  
            private double unitPrice;  
            private DateTime date;  
            private bool discontinued;  
 
            public MyBusinessObject(int ID, string Name, double UnitPrice, DateTime Date,  
                                    bool Discontinued)  
            {  
                this.ID = ID;  
                this.Name = Name;  
                this.UnitPrice = UnitPrice;  
                this.Date = Date;  
                this.Discontinued = Discontinued;  
            }  
 
            public int ID  
            {  
                get { return id; }  
                set { id = value; }  
            }  
 
            public string Name  
            {  
                get { return name; }  
                set { name = value; }  
            }  
 
            public double UnitPrice  
            {  
                get { return unitPrice; }  
                set { unitPrice = value; }  
            }  
 
            public DateTime Date  
            {  
                get { return date; }  
                set { date = value; }  
            }  
 
            public bool Discontinued  
            {  
                get { return discontinued; }  
                set { discontinued = value; }  
            }  
        }  
    }  
}  
 



Hristo Deshev
Telerik team
 answered on 28 Apr 2009
1 answer
116 views
I have a RadGridView that is bound to a list of Medication Objects.
A medication contains the following fields:
Drug - object                  Bound to Drug.Name
Dosage - string              Bound to Dosage
StartTime - DateTime     Bound to StartTime
EndTime - DateTime      Bound to EndTIme
Comments - String         Bound to Comments

When the control binds to my list, all of the fields are allowed to be grouped except for the Drug.Name. Is there a way to group this column?

Here is my XAML

 

 

<telerik:RadGridView Margin="-2,2,2,-2" AutoGenerateColumns="False" Name="radGridView1" ItemsSource="{Binding PatientMedications}">

 

 

 

<telerik:RadGridView.Columns>

 

 

 

<telerik:GridViewDataColumn HeaderText="Name" DataMemberBinding="{Binding Path=Drug_.Name}" UniqueName="{x:Null}"/>

 

 

 

<telerik:GridViewDataColumn HeaderText="Dosage" DataMemberBinding="{Binding Path=Dosage}" UniqueName="{x:Null}" />

 

 

 

<telerik:GridViewDataColumn HeaderText="Started" DataMemberBinding="{Binding Path=StartTime}" UniqueName="{x:Null}" />

 

 

 

<telerik:GridViewDataColumn HeaderText="Ended" DataMemberBinding="{Binding Path=EndTime}" UniqueName="{x:Null}" />

 

 

 

<telerik:GridViewDataColumn HeaderText="Comments" DataMemberBinding="{Binding Path=Comments}" UniqueName="{x:Null}" />

 

 

 

</telerik:RadGridView.Columns>

 

 

 

</telerik:RadGridView>

Thanks,

Billy Jacobs

 

Rossen Hristov
Telerik team
 answered on 28 Apr 2009
1 answer
142 views
Is there a way to hide the navigation control that automatically displays?
GPJ
Top achievements
Rank 1
 answered on 27 Apr 2009
4 answers
213 views
We have a WPF project which uses several telerik grids.  We bind to the grids by using setting the DataContext property in the Window_Loaded, and the ItemsSource on each grid to "{Binding}".  Using the Q308 release, the grids worked in Blend and Visual Studio (though had a whole host of other issues which I won't get into).  Now that Q109 is out, I have upgrade all of our references to the new DLLs, but not changed any code.  The project will build just fine, and the application will work (other than an issue that I will submit in another post).

However, with the new DLLS, the Visual Studio designer will crash as soon as I open the XAML (with no error), and Expression Blend refuses to open the XAML - it displays a NullReferenceException, which appears to being thrown in the Telerik.Windows.Controls.GridView.GridViewITemsControl.DisconnectFromDataEventsFunction().  I would paste the entire contents of the exception, but the developers of Blend apparently saw fit to not include the ability to copy the text of errors that occur in the application.

Any ideas, or do you need more information?
Nate
Top achievements
Rank 1
 answered on 27 Apr 2009
1 answer
196 views
Hello,
I have a collection of a class implementing ICustomTypeDescriptor bound to WPF GridView. Basic functionalities such as viewing, sorting, grouping and filtering works fine. But when I try to add an AggregateFunction to the groups  I receive a null reference exception. As far as I can see, the Properties collection of the RecordManager for the grid does not contain the property descriptions from the ICustomTypeDescriptor, Is there a solution or workaround for this situation?

Additionally, I would expect TypeDescriptionProvider attribute on a class would perform similar as implementing ICustomTypeDescriptor interface for the class. The Microsfot ListView control, for example, can handle this situation.

Thanks,

Mehmet Ali
Rossen Hristov
Telerik team
 answered on 27 Apr 2009
1 answer
130 views
Hi,
just loaded up the eval WPF Controls. I browsed through the demos and the only problem I found was with database access configuration (but I'm not too worried about that). What I did notice was the demo itself!  On my install the documentation reports as being corrupt (after install, uninstall and install) so I'm unable to look in there, but do you publish details of the application itself? Particularly the Navigation panel on the left :-) The source seems to be only partly supplied with the remainder being in Telerik.Windows.Quickstart.dll.
How is the Navigation panel put together? How does it slide the demo's in and out?

thanks
mark

Kaloyan
Telerik team
 answered on 27 Apr 2009
2 answers
298 views
Can you guys give me an example of selecting a row in the grid using databinding?

My DataContext will have a custom object with two values:

  • Object ItemsSource
  • Int SelectedRow

I want to use updates to the DataContexts to auto update the grid, ItemsSource="{Binding Path=ItemsSource}" works for the data, but i cannot figure out the selected row.

Dmitry
Top achievements
Rank 1
 answered on 24 Apr 2009
2 answers
204 views
I have a scenario where my first grid row value will always be an Enum, example values: Good, Bad, Warning.

As the rows are being created i need to switch from this enum to an Ellipse shape with a filled color of Green, Red, or Yellow depending on the enum. I tried to add code into the RowLoaded event and it works fine to detect the value, but when i set back to the Content property im getting an error.

Is there any good examples of this that i can use?
Dmitry
Top achievements
Rank 1
 answered on 24 Apr 2009
2 answers
967 views
OK. 

I'm using a gridView with cell/row editing enabled to keep a bound business object updated when elements in the grid are changed.  That part is working great.  I'm also using validation on the grid contents.  I allow the user to update the grid however they so chose, then click a 'save' button, at which point that changes are comitted to our db. 

The issue is that the validation only fires for a cell when you click another cell/row in the grid, hit tab, or hit enter.  So, if the user inputs invalid data, does not perform any of the actions listed in the last sentence, then clicks my save button, data is allowed to be stored improperly since the CellEditEnded event does not fire, which is what causes validation to be initiated, when they hit my button.  SO, I'm looking for a way to either manually fire that event, OR another way to accomplish my goal of validating the data on button click.

I hope that makes sense.  Any input would be appreciated. 

Thanks,
Marty
Marty
Top achievements
Rank 1
 answered on 24 Apr 2009
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
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?