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

I have this RadGridView:
<telerik:RadGridView x:Name="RadGridView1" GroupRenderMode="Flat" IsSynchronizedWithCurrentItem="True"
    IsReadOnly="True"
    AutoGenerateColumns="False"
    CanUserFreezeColumns="False"
    CanUserResizeColumns="True">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn Header="#Case" DataMemberBinding="{Binding caseId}" Width="Auto"></telerik:GridViewDataColumn>>
        <telerik:GridViewDataColumn Name="CategoriesGridViewDataColumn" Header="Categories" Width="Auto">
            <telerik:GridViewDataColumn.CellTemplate>
                <DataTemplate>
                    <Grid Margin="0" Name="categoriesGird">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="1*"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="1*"/>
                            <ColumnDefinition Width="1*"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Row="0" Grid.Column="0" Background="Red"></TextBlock>
                        <TextBlock Grid.Row="0" Grid.Column="1" Background="Blue"></TextBlock>
                    </Grid>
                </DataTemplate>
            </telerik:GridViewDataColumn.CellTemplate>
        </telerik:GridViewDataColumn>
    </telerik:RadContextMenu.ContextMenu>
</telerik:RadGridView>

This give me something like the image in attachments.
As you can see I have 2 TextBlock for each row (column categories). But I want to fill the GridView table with information that I have in a a class that i created (number of categories is dynamic, so I want the number of TextBlock for each row depends how many categories i have in a list):
public class EmailTest
{
       public EmailTest() { }
 
       public EmailTest(string caseId, List<TextBlock> categories)
       {
          this.caseId = caseId;
          this.categories= categories;
       }
 
       public string caseId{ getset; }
       public List<TextBlock>categories{ getset; }
  }


How can I solve this problem?
Hadrien
Top achievements
Rank 1
 answered on 22 Nov 2012
1 answer
142 views
Hello,

the PivotGrid is a really great control. When is it planned to be final? And will the final control contain some exporting functionality?

Best regards,

Michael
Rosen Vladimirov
Telerik team
 answered on 22 Nov 2012
1 answer
69 views
I am generating a pie chart in c# code. The resulting pie chart looks good, except that the labels are all straight along the centre, instead of where they are supposed to be, as can be seen in the image. Any idea what I am doing incorrectly?

Mike
Top achievements
Rank 1
 answered on 22 Nov 2012
1 answer
160 views
After following the instruction in the forum post How do you enter multiple lines of text in a cell I now have a nice way to enter multiple lines of text into a cell of my RadGridView control however if you actually attempt to use this for text that is of any significant size you will notice that the RadGridView control will not scroll along with keyboard cursor within the TextBox. To see the effect load the example from the aforementioned post and attempt to type in the the second column and create enough lines so that the text wraps past the bottom of the visible scroll region of the RadGridView. Has anybody found away to work around this? I've noticed all of the scroll into view methods but none seem to be specific to a position within a child control of an edit template of a column of the RadGridView. I'm guessing one could look for changes in size of the hosted TextBox and then attempt to adjust the scroll position of the RadGridView but I'm wondering if anybody else has already solved this problem as it seems like it would be a common one.

After writing this post I realized that the same issue may also exist when entering simple single line text where the right portion of the column happens to be partially off of the horizontal scroll region and sure enough that also exhibits the same problem So I guess my question is a general one, how to make RadGridView follow the keyboard cursor when editing text in one of the cells?
Yoan
Telerik team
 answered on 22 Nov 2012
1 answer
184 views
Is it possible to defer the filtering until some point, suchas when the DataFilter loses focus?
Thanks in advance,
Steve
Dimitrina
Telerik team
 answered on 22 Nov 2012
0 answers
144 views

Hello,

Is it possible to bind two comboboxes to one table with composite primary key?

Suppose one has a table MyTable with two fields (int Level, varchar2 Code) which forms composite primary key.

The corresponding entity is

public class MyTable
{
   public MyEnum Level {get; set;}
   public string Code {get; set;}
}

where MyEnum is some enum.

I would like to bind two comboboxes to the list of such entities so that one combobox shows list of available items of MyEnum,

and the other one list of codes corresponding to the selected Level. Is it possible?

Thanks in advance.

Yours faithfully,

Mikhail.

MuxMux
Top achievements
Rank 1
 asked on 22 Nov 2012
2 answers
220 views
Hi,
I'm trying to show a RadGridView with a RadChart in each row.
Binding the grid's ItemSource to the relevant property works, all charts show the data labels,
However, only the last row's chart shows the actual value heights (see attached image).

Another issue is the commented ChartArea.AxisX. uncommenting this property section causes an NullReferenceException to be thrown from Telerik.Windows.Controls.Charting.AxisX.CalculateItemRange(DataSeries dataSeries, Int32 index)

Window1.xaml:
<Window x:Class="testApp.Window1"
        xmlns:my="clr-namespace:testApp"
        xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
        xmlns:telerikChart="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting"
        xmlns:telerikCharting="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"
        Title="Window1" Height="300" Width="300">
    <Window.Resources>
        <my:Window1ViewModel x:Key="MyViewModel"/>
    </Window.Resources>
    <Grid x:Name="LayoutRoot" DataContext="{StaticResource MyViewModel}">
        <telerik:RadGridView ItemsSource="{Binding Items}" AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Label}"/>
                <telerik:GridViewDataColumn Header="Values">
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <telerikChart:RadChart ItemsSource="{Binding Values}"
                                                           UseDefaultLayout="False" MaxWidth="200" MaxHeight="100">
                                <telerikCharting:ChartArea x:Name="MyChartArea">
                                    <telerikCharting:ChartArea.AxisY>
                                        <telerikCharting:AxisY/>
                                    </telerikCharting:ChartArea.AxisY>
                                    <!--<telerikCharting:ChartArea.AxisX>
                                        <telerikCharting:AxisX/>
                                    </telerikCharting:ChartArea.AxisX>-->
                                </telerikCharting:ChartArea>
                                <telerikChart:RadChart.SeriesMappings>
                                    <telerikCharting:SeriesMapping ChartAreaName="MyChartArea">
                                        <telerikCharting:SeriesMapping.SeriesDefinition>
                                            <telerikCharting:LineSeriesDefinition LegendDisplayMode="None"/>
                                        </telerikCharting:SeriesMapping.SeriesDefinition>
                                        <telerikCharting:SeriesMapping.ItemMappings>
                                            <telerikCharting:ItemMapping DataPointMember="YValue"/>
                                        </telerikCharting:SeriesMapping.ItemMappings>
                                    </telerikCharting:SeriesMapping>
                                </telerikChart:RadChart.SeriesMappings>
                            </telerikChart:RadChart>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
 
    </Grid>
</Window>

Window1ViewModel.cs:
using System.Collections.Generic;
using System.Collections.ObjectModel;
 
namespace testApp
{
  class Window1ViewModel
  {
    public ObservableCollection<ItemsClass> Items { get; set; }
 
    public Window1ViewModel()
    {
      Items = new ObservableCollection<ItemsClass>
              {
                new ItemsClass("Test1", new[] {0.1, 0.3, 0.5, 0.2}),
                new ItemsClass("Test2", new[] {0.2, 0.3, 0.5, 0.2}),
                new ItemsClass("Test3", new[] {0.3, 0.3, 0.5, 0.2})
              };
    }
  }
 
  public class ItemsClass
  {
    public string Label { get; set; }
    public IEnumerable<double> Values { get; set; }
 
    public ItemsClass(string label, IEnumerable<double> values)
    {
      Label = label;
      Values = values;
    }
  }
}

Any idea?
Thanks,
Edo
Edo
Top achievements
Rank 1
 answered on 22 Nov 2012
1 answer
178 views
Hi,

I'm trying to mimic the autocomplete behavior of Excel in a GridView. For this, I have DataBoundColumns, and replaced the CellEditTemplate with an AutoCompleteBox (ACB).
<telerik:GridViewDataColumn DataMemberBinding="{Binding ItemContent}">
    <telerik:GridViewDataColumn.CellEditTemplate>
        <DataTemplate>
            <telerik:RadAutoCompleteBox
                ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=telerik:RadGridView, AncestorLevel=1}, Path=DataContext.ListOfItemContent}"
        />
        </DataTemplate>
    </telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>

The not-so-simple ACB ItemsSource binding is for an MVVM approach, trying to reach the VM for the GridView.
My questions:
  • Is there an easier way to do this? (for example, the ComboBoxColumn has ItemsSource and ItemsSourceBinding)
  • What is the "Text" property for an ACB? (Can't find one, and the on-line documentation is a bit scarce for this control...)
  • Could you make a new GridColumn type, that would use /inherit from/ ACB? (like the special ones you already have)

According to this thread, the Text property would be the SearchText property, and it has some issues:

http://www.telerik.com/community/forums/wpf/autocompletebox/setting-the-searchtext.aspx
I can reproduce the same exception with the above code. The ListOfItemContent is the list of strings in the current column. It's in the VM.

public IEnumerable<string> ListOfItemContent
{
  get
  {
    return
      (from i in this.MyBusinessObjects
      select i.ItemContent).Distinct();
  }
}

Thank you,
Gyula

Ivo
Telerik team
 answered on 22 Nov 2012
6 answers
295 views
Is there a roadmap for improving the exporting features of this grid? If so can you please point me to it? Im curious as to what to expect from future release in regards to exporting which is one of our most important end user requirements.
Makarand
Top achievements
Rank 1
 answered on 22 Nov 2012
2 answers
139 views
When updating values of like 1000 cells every 500ms (for example), the UI would lock.
I also did this experiment with 100ms update rate, and the grid was not able to handle it.

The reason I'm checking it is because in my project, I'm connected to a remote hardware from which I read a byte array that represents the data of the cells.
I already wrote the mechanism that knows which rows are visible and therefore reads only the byte array that corresponds the visible rows.
Updating values on none visible rows should almost have no affect because of the UI virtualization.
I know that there is a chance that some cells on the DataTable (my ItemsSource) will not have their value changed on the remote hardware (and in this case I can optimize my code, so it won't overwrite the value, to prevent notification to the UI), but in my example, I'm taking the worst case scenario....


I have decided to check it with some more data grids.

Syncfusion - Almost the same poor performances.
Component One FlexGird - Good performance but lots of bugs (values doesn't get updated after scroll etc).
Micorsoft DataGrid - Good performance
ListView with GridView - Very good performance.


Another thing, GroupRenderMode="Flat" should increase the scroll performance (at least from what your documentation says), but it actually makes it worse!


Is there a better way of doing what I do? (Is there a way of getting the performance at least near the ListView or the DataGrid?)
Thanks.


I'm unable to attach the solution, but here is the code:

    public abstract class ViewModelBase : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
 
        public void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
 
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Threading.Tasks;
using System.Threading;
 
namespace WpfGridsPerformanceTest
{
    public class MainViewModel : ViewModelBase
    {
        private MyDT _data;
        private DelegateCommand _changeValuesCommand;
 
        public MainViewModel()
        {
            _data = new MyDT();
 
            for (int i = 0; i < 400; i++)
            {
                DataRow row = _data.NewRow();
                _data.Rows.Add(row);
            }
        }
 
        public DataView Items
        {
            get
            {
                return _data.DefaultView;
            }
        }
 
        public DelegateCommand ChangeValuesCommand
        {
            get
            {
                if (_changeValuesCommand == null)
                {
                    _changeValuesCommand = new DelegateCommand(changeValues);
                }
 
                return _changeValuesCommand;
            }
        }
 
        private void changeValues()
        {
            Task t = new Task(() =>
            {
                while (true)
                {
                    foreach (DataRow row in _data.Rows)
                    {
                        for (int i = 0; i < row.ItemArray.Count(); i++)
                        {
                            row[i] = (int)row[i] + 1;
                        }
                    }
 
                    Thread.Sleep(500);
                }
            });
 
            t.Start();
        }
    }
}
 
 
 
<Window x:Class="WpfGridsPerformanceTest.MainWindow"
        xmlns:local="clr-namespace:WpfGridsPerformanceTest"
        Title="MainWindow" Height="350" Width="525" WindowState="Maximized">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
 
        <local:Telerik />
         
        <!--<local:Syncfusion />-->
         
        <!--<local:DataGrid />-->
         
        <!--<local:ListView />-->
        <Button Grid.Row="1" FontWeight="Bold" FontSize="16" Command="{Binding ChangeValuesCommand}">Click to start changing values</Button>
    </Grid>
</Window>
 
 
 
 
 
 
 
 
 
<UserControl x:Class="WpfGridsPerformanceTest.Telerik"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <telerik:RadGridView ItemsSource="{Binding Items}"
                             ShowGroupPanel="False"
                             UseLayoutRounding="False"
                             RowIndicatorVisibility="Collapsed"
                             DataLoadMode="Synchronous"
                             CanUserFreezeColumns="False"
                             CanUserSortColumns="False"
                             CanUserSelect="True"
                             SelectionMode="Single"
                             SelectionUnit="FullRow" />
    </Grid>
</UserControl>
BENN
Top achievements
Rank 1
 answered on 22 Nov 2012
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
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?