Telerik Forums
UI for WPF Forum
2 answers
210 views
Hi,

 I have specific requirement. I need to implement a radgridview with a row that contains a combobox in the first column on load of the grid. I have a button at the last column of the same row. i use that button to fill the details in the row based on the item selected in the combobox. once filled the combobox should be replaced with the normal cell. and the default row should be moved to the next row to add another item.

Please help me to solve this .

regards
SKB
Swaroop
Top achievements
Rank 1
 answered on 25 Jan 2012
0 answers
89 views
Hi 

I used binding DataTable to GridView...


flowing code:
DataTable table = new DataTable("Data Table");
 
DataColumn column;
DataRow row;
 
column = new DataColumn();
column.DataType = typeof(DateTime);
column.ColumnName = "Time";
column.ReadOnly = true;
column.Unique = true;
table.Columns.Add(column);
 
column = new DataColumn();
column.DataType = typeof(double);
column.ColumnName = "A";
column.ReadOnly = true;
column.Unique = false;
table.Columns.Add(column);
 
column = new DataColumn();
column.DataType = typeof(double);
column.ColumnName = "B";
column.ReadOnly = true;
column.Unique = false;
table.Columns.Add(column);
 
// Create three new DataRow objects and add
// them to the DataTable
for (int i = 0; i <= 20; i++)
{
    row = table.NewRow();
    row["Time"] = DateTime.Now.AddSeconds(i);
    row["A"] = random.NextDouble() * 100;
    row["B"] = random.NextDouble() * 50;
 
    table.Rows.Add(row);
}
 
gridView.ItemsSource = table;

and then i used CustomAggregateFunction .. 

public static class Statistics
{
    public static double StdDev<TSource>(DataTable source, Func<TSource, double> selector)
    {
        int itemCount = source.Rows.Count();
        if (itemCount > 1)
        {
            IEnumerable<double> values = from i in source select Convert.ToDouble(selector(i));
 
            double sum = SumAvg(values);
 
            return Math.Sqrt(sum / (itemCount - 1));
        }
 
        return 0;
    }
 
    private static double SumAvg(IEnumerable<double> values)
    {
        double average = values.Average();
        double sum = 0;
 
        foreach (double item in values)
        {
            sum += Math.Pow(item - average, 2);
        }
 
        return sum;
    }
}

public class StandardDeviationFunction : EnumerableSelectorAggregateFunction
{
    protected override string AggregateMethodName
    {
        get
        {
            return "StdDev";
        }
    }
 
    protected override Type ExtensionMethodsType
    {
        get
        {
            return typeof(Statistics);
        }
    }
}

but this function occur exception :
{"No generic method 'StdDev' on type 'NS.Client.Models.Controls.Statistics' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic. "}

what's wrong??

Guntae Park
Top achievements
Rank 1
 asked on 25 Jan 2012
3 answers
137 views
Hi,

How do i add RadPanelBarItem from codebehind?

regards,
SKB
Swaroop
Top achievements
Rank 1
 answered on 24 Jan 2012
0 answers
178 views
I have a Telerik GridView that I am using in MVVM mode. That is, I've not implemented event handlers in the code-behind, rather I've bound it to an ObservableCollection.  And I have two problems.

When I click on the "Click here to add new item" bar in the grid, the CollectionChanged event on the collection fires, with it's Action set to NotifyCollectionChangedAction.Add.  Which is what I would expect to happen.  Then after the handler returns, the new blank row appears at the top of the grid.

The first problem: it's the second cell that is selected, and actively editable, not the first.

How do I configure the editor to have the first cell selected?  It clearly can't be in the ViewModel - the observable collection doesn't have access to the grid - and shouldn't.  Is there something I can add to the XAML that would control which field is active, when editing?

(One thing that might be relevant - the first cell is only editable when adding a new record, it's read-only when editing an existing record.  The GridViewDataColumn has its IsReadOnlyBinding property bound to a property in the viewmodel that is true when editing an existing record.  So when editing an existing row, I want to start editing with the second cell, when adding a new a new row I want to start editing with the first.)

The second problem: updating the data.

The rows in the grid are bound to elements in the collection, and those elements implement INotifyPropertyChanged.  So when I am editing a record in the grid, after I leave each file, the propertyChanged event fires on the element.  In that, I can update the underlying data store - except that I don't want to.  I don't want to insert or update the record, after every field is changed, I want to do one insert or update when the row is complete. 

But I can't figure out what event would indicate that editing of the row is complete.  PropertyChanged is fired on the element as every field is changed, it doesn't tell me when the user is done editing a row.  And Collection changed is fired when a new element is added to the collection, it doesn't fire to tell me that one of the elements has changed.

So, how do folks usually handle this?

== addendum ==
For what it's worth, I've tried adding an AddingNewDataItem handler:
void customerAttributesGrid_AddingNewDataItem(object sender,
        telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
{
    var grid = e.OwnerGridViewItemsControl;
    grid.CurrentColumn = grid.Columns[0];
}
It's not helped.  The event fires, I can walk through the handler in the debugger, setting CurrentColumn as suggested, then the CollectionChanged event fires and I walk through that.  But when I'm done, the second column is still current.
Jeff
Top achievements
Rank 1
 asked on 24 Jan 2012
1 answer
170 views
Hi,

I'm in WPF and I would like to know if it's possible to change the style of my RadTabItems to have a style like this the enclosed pictiure. Of course, the colors of my Telerik theme need to be maintain.

Thank's
Petar Mladenov
Telerik team
 answered on 24 Jan 2012
3 answers
145 views

I have a Radgrid and Datapager which is bound as the code below, the item source is a linq to sql class, the class is queried and the results are converted into a pivot table and both the pager and grid’s source properties are set and the grid has Aggregate Results and sort descriptors added this works well. I have a refresh button on the page but I can’t work out how to clear the pager and grid when the user clicks the button. I have tried your sample code but get errors. Could you please advise on the correct method.

 

<telerik:RadGridView x:Name="AgedJobsListgrid" ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Black" ShowColumnFooters="True" IsScrolling="False" IsTabStop="False" RowIndicatorVisibility="Collapsed" VerticalAlignment="Stretch"  DataContext="{Binding ElementName=radDataPager}" RowHeight="35" FontSize="14"></telerik:RadGridView>

            <telerik:RadDataPager x:Name="radDataPager" telerik:StyleManager.Theme="Office_Black"

                         PageSize="10"

                         DisplayMode="All"

                         IsTotalItemCountFixed="True" Source="{Binding AgedListClass}"  DataContext="{Binding ElementName=AgedJobsListgrid}" />

 

       ‘code used to clear the pager and grid which fails when setting the itemsource to nothing.

radDataPager.Source = Nothing

AgedJobsListgrid.GroupDescriptors.Clear()

        AgedJobsListgrid.ItemsSource = Nothing

        AgedJobsListgrid.Columns.Clear()

        AgedJobsListgrid.AutoGenerateColumns = True

 

Dimitrina
Telerik team
 answered on 24 Jan 2012
2 answers
124 views
I have created a UserControl which consists of the RadDocking control.  Within this I place the RadPaneGroups and subsequent RadPanes.  Each RadPane contains a View, to which a ViewModel is created.  The problem occurs when I place the upper most UserControl, with the RadDocking, in a tab.  The tabs are dynamically created very similar to your expample with RadTab.  Each time I switch tabs I see the Views being reinstantiated and in turn the ViewModel and Model.  When I remove the upper most UserControl, with the RadDocking control, this does not occur.  What is best practice of placing the RadDocking control within tabs without encountering this behavior?

Thank you
Paul
Top achievements
Rank 1
 answered on 24 Jan 2012
3 answers
117 views
Hi,
   I'm working in a Wpf application which requires the transparent header & body area. I tried using different themes available with the telerik control, i'm not able to achieve the desired result. If i set "Transparent" to the rowstyle, the default theme style comes up, but if i use any color it works fine. I have attached the sample of my required grid. Please help me to achieve the desired style. Also let me know how to disable or configure the mouseover effect for the Rows.


Thanks
Selva
Selva M
Top achievements
Rank 2
 answered on 24 Jan 2012
5 answers
598 views
Hi,

I have following markup for my RadGridView:

<telerik:RadGridView  
    ItemsSource="{Binding PagedSource, ElementName=radDataPager}"
    SelectedItem="{Binding Path=SelectedAccount, Mode=TwoWay}"
    IsBusy="{Binding IsSearchActive}"
    IsReadOnly="True"
    CanUserDeleteRows="False"
    CanUserInsertRows="False"
    ShowGroupPanel="False"
     
    AutoGenerateColumns="False">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding AccountNumber}" Header="Account #" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding FullName}" Header="Name" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Email}" Header="Email" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding OrganizationName}" Header="Organization" />
    </telerik:RadGridView.Columns>
    <telerik:RadGridView.InputBindings>
        <MouseBinding Gesture="LeftDoubleClick" Command="{Binding DisplayViewCommand}" />
        <KeyBinding Key="Enter" Command="{Binding DisplayViewCommand}" />
    </telerik:RadGridView.InputBindings>
     
    <telerik:RadGridView.RowStyle>
        <Style>
             
        </Style>
    </telerik:RadGridView.RowStyle>
 
</telerik:RadGridView>

Now, when I hit "Enter" key the DisplayViewCommand is invoked in my ViewModel as expected.
But the DoubleClick doesn't work for some reason. (BTW: if I am double click on the Grid Header (the empty cell in top right corner) the command is triggered but of course I expect that current row double click should work also)


What I am doing wrong?


Vlad
Telerik team
 answered on 24 Jan 2012
1 answer
108 views
How co-ordinates of zoom rectangle can be captured for RadChart ?
Yavor
Telerik team
 answered on 24 Jan 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
PersistenceFramework
DataPager
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
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
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?