Telerik Forums
UI for WPF Forum
2 answers
404 views
I am writing a WPF application using MVVM, I am trying to bind a nested complex object to the telerik radGridView control. I basically need to create the datagrid dynamically and I only know at run time how many columns it will have also the columns need to be generated from the rows...


The MetaDataDO class,
public class MetaDataDO
{
public int MetaItemId { get; set; }
public string Name { get; set; }
public int SequenceNumber { get; set; }
public IList<ItemDO> Volumes { get; set; }
}

The ItemDO class,
public class ItemDO
{
public int ItemId { get; set; }
public DateTime StartDateTime { get; set; }
public DateTime EndDateTime { get; set; }
public int Period { get; set; }
public decimal Price { get; set; }
}

In my view model I have a property ObservableCollection MetaDataCollection that can have N number of MetaDataDO, each MetaDataDO will have 4 Prices in it. Example data below..

MetaDataCollection
1, UK, 10,
                 Volumes
                         1, 24/01/2014 00:00, 24/01/2014 06:00, 1, 100
                          2, 24/01/2014 06:00, 24/01/2014 12:00, 2, 120
                          3, 24/01/2014 12:00, 24/01/2014 18:00, 3, 110
                          4, 24/01/2014 18:00, 24/01/2014 24:00, 4, 150

2, UAE, 20,
                  Volumes
                          1, 24/01/2014 00:00, 24/01/2014 06:00, 1, 500
                          2, 24/01/2014 06:00, 24/01/2014 12:00, 2, 140
                          3, 24/01/2014 12:00, 24/01/2014 18:00, 3, 510
                          4, 24/01/2014 18:00, 24/01/2014 24:00, 4, 550
.... can have N more...

I have no control over how these existing objects are defined, these are being returned by an external system. Once I receive the data in my viewmodel,

I want to display the results on the UI in the radGridView in the following format,

            Start            |             End             | UK | USA
--------------------------------------------------------------------
24/01/2014 00:00 | 24/01/2014 06:00 | 100 | 500
24/01/2014 06:00 | 24/01/2014 12:00 | 120 | 140
24/01/2014 12:00 | 24/01/2014 18:00 | 110 | 510
24/01/2014 18:00 | 24/01/2014 24:00 | 150 | 550

so in simple terms, i am trying to bind the property to the radGridView in the following way...

            Start            |             End                  |                                           UK                                                                                            |                       USA
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
MetaDataCollection[0].Volumes[0].Start | MetaDataCollection[0].Volumes[0].End | MetaDataCollection[0].Volumes[0].Price | MetaDataCollection[1].Volumes[0].Price 
MetaDataCollection[0].Volumes[1].Start | MetaDataCollection[0].Volumes[1].End | MetaDataCollection[0].Volumes[1].Price | MetaDataCollection[1].Volumes[1].Price 
MetaDataCollection[0].Volumes[2].Start | MetaDataCollection[0].Volumes[2].End | MetaDataCollection[0].Volumes[2].Price | MetaDataCollection[1].Volumes[2].Price 
MetaDataCollection[0].Volumes[3].Start | MetaDataCollection[0].Volumes[3].End | MetaDataCollection[0].Volumes[3].Price | MetaDataCollection[1].Volumes[3].Price 

How do I bind the property which is really a complex nested object to the radGridView to achieve this output format? Any hints welcome...

Thanks
Tarun
















Nick
Telerik team
 answered on 04 Jul 2014
1 answer
102 views
Hi,

while the DateTimePicker (when adding a new Appointment) works as expected the RadScheduleView itself has several "strange" behaviors.
First - Hours are displayed in 12h format (without AM / PM marker) not in 24 hour format as set by the OS (and used by the DateTimePicker).

Next - in Timeline the Date separator is a minus sign instead of a dot.
So it shows (in correct order day month year)  03-07-2014 instead of 3.7.2014 or at least 03.07.2014.
Kalin
Telerik team
 answered on 04 Jul 2014
3 answers
150 views
Hi,

in Outlook - month view - I get the days of the current month in white while the days of the preceding / following months have a different color.
Your RadCalendar does something like this by formatting the days "non bold".

Can this be done "out of the box" or do I have to define "special slots" or things like these?
Yana
Telerik team
 answered on 04 Jul 2014
2 answers
139 views

Hi,

I'm in a situation where I have a sub-collection in my GridView of a complex type and was hoping I could perform a filter like the following:

ItemPropertyDefinition tagDefinition = new ItemPropertyDefinition("Tags.Tag", typeof(string), "Tags");
this.RadDataFilterBlogProperties.ItemPropertyDefinitions.Add(tagDefinition);

This is obviously not working....
In a previous post I saw something about using a QueryableCollectionView with Linq and binding it to the DataFilter.
...but after doing some research I can't even find an event where I can overwrite/bypass the default filter behaviour of the datafilter.

---

My current solution/workaround is adding an extra property to the collection that is bound to the GridView that has all the strings from the sub-collection combined ... and letting the DataFilter, filter on that field...  But this method is slow and not really correct.

Thanks in advance,


Dimitrina
Telerik team
 answered on 04 Jul 2014
2 answers
229 views
Hi,

since I work with MVVM I want to avoid code-behind as much as possible.
I need "read only appointments" and found this in help http://www.telerik.com/help/wpf/radscheduleview-features-speacialslots.html

Although I love your controls I really miss good MVVM support.
For an example RadGridView (which I use a lot due to its performance and capabilities) is not useable with "pure MVVM" due to the lack of Command support.
Almost everything is handled via events (like RowEditEnding, RowValidating)...

But there are at least "simple behaviors" like "CanUserEdit" or so which need no code behind.

How about RadScheduleView? Is there a way to avoid code behind (except subclassing the control)?

My need - some appointments have to be ReadOnly - either in general or for certain users (owner may edit / reader must not).
I can provide a property at the appointment (IsReadOnly or so) - so all I need is to handle this with RadScheduleView...
ManniAT
Top achievements
Rank 2
 answered on 04 Jul 2014
8 answers
263 views
Here's the function that creates RadPieChart.

private RadPieChart BuildPieChart(ContentModel contentData) {
    // Chart
    var chart = new RadPieChart();
 
    // Chart's Pie Series
    var pieSeries = new PieSeries {
        Name = "PieSeries",
        ShowLabels = true
    };
 
    // Building Data Points
    GetDataPoints(contentData, ContentTypeFlag.PieChartStatic).ToList().ForEach(a => {
        pieSeries.DataPoints.Add(a);
        pieSeries.SliceStyles.Add(Util.GenerateSliceStyle());
    });
 
    chart.Series.Add(pieSeries);
 
    return chart;
}

GetDataPoints() returns the IEnumerable<PieDataPoint>, and Util.GenerateSliceStyle() returns Style.

The color on the slice is set, however, all the slices always end-up being the same color. 
Is there a way of making each slice different color via Code Behind?
Any help (a code example would be the best) would be appreciated. Thank you.

At the moment, this is the result I get (as I mentioned, all the slices are of same color):

Petar Marchev
Telerik team
 answered on 04 Jul 2014
1 answer
126 views
I have an application where am deleting row in RadGrdiView.
After deletion, visibly am able to see that the row got deleted but it became hidden. I am observing this behaviour with SPY tool like UIVerify or SPY tool etc...

If I create a new row with same content I will end up with two similar rows one is hidden and the other is newly created row.

Because fo this reason my CUIT script is failing by saying "Unable to click on hidden control".

I am able to reproduce this problem on a simple GirdView apllication.
Any help regarding this would be highly appreciable.

Regards,
Abilash

Maya
Telerik team
 answered on 04 Jul 2014
1 answer
205 views
I would like to make an Expander is expanded or collapsed only if you clicked on the button to the left and not if you click the header.

The thing is possible?
Martin Ivanov
Telerik team
 answered on 04 Jul 2014
1 answer
710 views
I have objects which contain lists of dynamic and unique Child objects.  I would like to pivot the Child objects onto the grid so they display as one row.  I have the grid working but I can't quite get the syntax for the binding.

I have an object model like the following:

public class ParentObject
string Name
long ObjectId
List<Child> Children {get; set]

public class Child
string ChildName
string ChildValue

My grid is defined as:
<telerik:RadGridView  x:Name="myGrid" Grid.Row="0" VerticalContentAlignment="Stretch" AutoGenerateColumns="False">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name}" />
<telerik:GridViewDataColumn Header="Object Id" DataMemberBinding="{Binding ObjectId}" />
</telerik:RadGridView.Columns>

In the code behind I dynamically add every possible Child.Name to the grid as new columns.
List<Child> allChildren = _dataAccess.GetChildren();
 foreach (Child c in allChildren)
 {
                myGrid.Columns.Add(
                    new GridViewBoundColumnBase 
                    {
                      //DataMemberBinding = new Binding("Children[0].Value"),   //this does display the child value but puts it in every column.  I can't hardcode the 0
                        //DataMemberBinding = new Binding("Children[\"" + c.ChildName.Replace(" ","") + "\"].ChildValue"),   //tried by child Name but it doesn't bind.  To do this I updated my List so it was searchable by Name. 
                        //DataMemberBinding = new Binding("Children.ChildValue"),   Does not work
                        Name = c.Name.Replace(" ", ""),
                        Header = c.Name
                    });
    }
All of the correct columns display, I just need to know if it is possible to do a match on the ParentObject.Children.Name to a column so the grid can display the ChildValue field.
A Linq statement similar to Where(x => x.name = column name) I would think would work if that is possible in a Binding.








Boris
Telerik team
 answered on 04 Jul 2014
2 answers
178 views
Perhaps I am just missing some settings, or maybe this is just how it is at the moment, but I cannot seem to get documents with images to print with any kind of quality.

The image is in the header, I can recreate the document in Word, and copy/paste the image back and forth between Word and RadRichTextBox; the image is crisp and clear in Word and horribly unclear when printed from the RadRichTextBox. If I export the document as a word document and print it form Word that way, the images are unclear as well.

Is there anything I can do?
C
Top achievements
Rank 1
 answered on 03 Jul 2014
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
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
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
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?