Telerik Forums
UI for WPF Forum
1 answer
188 views
I'm extending a GridViewComboBoxColumn, setting IsComboBoxEditable to true, and trying to provide code to add typed text as items into the ItemsSource collection.

I hooked the CellEditEnded event of the GridView and added some test code to play with this idea:

private void TestGrid_CellEditEnded(object sender, Telerik.Windows.Controls.GridViewCellEditEndedEventArgs e)
{
    var comboBoxColumn = e.Cell.Column as Telerik.Windows.Controls.GridViewComboBoxColumn;
   
    // only continue if its a cell for the column we're interested in
    if ((comboBoxColumn == null) || (comboBoxColumn.UniqueName != "Lookup"))
        return;

    // get back the object used to represent the row
    var gridItem = e.Cell.DataContext as GridItem;
           
    // only continue if the text typed is not in the list
    if (gridItem.SelectedLookupItem != null)
        return;

    var cellComboBox = (RadComboBox)e.EditingElement;
    var lookupItemCollection = cellComboBox.ItemsSource as ObservableCollection<LookupItem>;

    var newItem = new LookupItem() { Name = cellComboBox.Text };
    lookupItemCollection.Add(newItem);

    //set the typed item as the selected item
    gridItem.SelectedLookupItem = newItem;
}

Works great. Now I want to move that code into my extended GridViewComboBoxColumn. How could I hook/override the CellEditEnded from inside the extended column?

Dimitrina
Telerik team
 answered on 12 Jan 2012
1 answer
57 views
I have two different collections with items of type A and B where B contains a child collection of type A and I'm displaying these two collections in two different RadGridViews and what I want to do is to be able to drag an item from one grid to the other so that I can add the appropriate item to the child collection (thus building a relationship between the two collections). I'm fairly new with WPF and just can't seem to see how to modify the examples to accomplish this DnD scenario. I'm guessing that I have to call the appropriate RadDragAndDropManager static methods for each row of the grid but as my grids are bound to my collection (via a View Model) I'm not sure how to do this or if it's the correct approach.

Any help/pointers would be greatly appreciated!

-Gary
Gary
Top achievements
Rank 1
 answered on 12 Jan 2012
2 answers
146 views
I'm sure there is some property I am missing, but I am having an issue on initial load of the grid.

Given the following code, if I expand the width of "Column 1" to the right, I never get the horizontal scrollbar visible to scroll to view the hidden columns.  This happens with EnableColumnVirtualization set to "True" as well.

<Window x:Class="WpfApplication1.GridWindow"
        Title="GridWindow" Height="300" Width="600">
    <Grid>
        <telerik:RadGridView EnableColumnVirtualization="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewColumn Header="Column 1" />
                <telerik:GridViewColumn Header="Column 2" />
                <telerik:GridViewColumn Header="Column 3" />
                <telerik:GridViewColumn Header="Column 4" />
                <telerik:GridViewColumn Header="Column 5" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</Window>
Ievgen
Top achievements
Rank 1
 answered on 11 Jan 2012
0 answers
126 views
how to customize RadDataForm. means how to add manually textbox , combobox , datatime and etc control
and how to bind with database.
please give me example.
aavadesh
Top achievements
Rank 1
 asked on 11 Jan 2012
6 answers
138 views
Hi,

We are currently having issues running our application on Windows 7 tablet PC's. When the grid has data, we get a NullReferenceException. I found it that the exception will not occur when removing a specific column definition from the gridview:

  <telerik:GridViewColumn     CellTemplate="{StaticResource StatusButtons}"
                                            IsFilterable="False"
                                            MaxWidth="120"
                                            MinWidth="120"
                                            />

The application works fine on non-touch devices, but on touch devices (Win 7, .Net 3.5) the error occurs. Stopping the "Tablet PC Input" service does not help as mentioned in other threads.

The exception plus stacktrace

2012-01-09 10:09:18,868 FATAL - User Interface : Unhandled Exception
System.NullReferenceException: De objectverwijzing is niet op een exemplaar van een object ingesteld.
   bij System.Windows.Automation.Peers.AutomationPeer.EnsureChildren()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateChildren()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   bij System.Windows.ContextLayoutManager.fireAutomationEvents()
   bij System.Windows.ContextLayoutManager.UpdateLayout()
   bij System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   bij System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   bij System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   bij System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   bij System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   bij System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   bij System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)


The Xaml:
<UserControl x:Class="BrabantWater.UI.Screens.ZInspectionListScreen"
    xmlns:imageFactory="clr-namespace:Sap.Eam.UI.Theme;assembly=CustomTheme_WPF"
    Height="auto" Width="auto">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="boolToVisConverter"/>
        <DataTemplate x:Key="StatusButtons">
            <StackPanel Orientation="Horizontal" Width="110">
                <telerik:RadButton Click="RadButtonDelete_Click" MinWidth="50"
                                   IsEnabled="{Binding Path=IsDeletable, Mode=OneWay}">
                    <Image Source="{Binding Path=DeleteImage, Mode=OneWay}" Width="32"/>
                </telerik:RadButton>
                <telerik:RadButton Click="RadButtonStatus_Click" MinWidth="50"
                                   IsEnabled="{Binding Path=IsEditable,Mode=OneWay}">
                    <Image Source="{Binding Path=StatusImage, Mode=OneWay}" Width="32"/>
                </telerik:RadButton>
            </StackPanel>
        </DataTemplate>
    </UserControl.Resources>
    <Grid x:Name="GridContainer">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
 
        <StackPanel Grid.Row="0" Orientation="Horizontal" Margin="5,5,5,5" Height="35" HorizontalAlignment="Stretch" VerticalAlignment="Center">
            <telerik:RadButton x:Name="ButtonNewInstallation" Content="{lex:LocText Key=Inspection_New_Installation, Dict=InspectionResources, Assembly=Win32Resources}" MinWidth="100" Click="ButtonNewInstallation_Click"/>
            <telerik:RadButton x:Name="ButtonNewDamage" Content="{lex:LocText Key=Inspection_New_Defect, Dict=InspectionResources, Assembly=Win32Resources}" Margin="10,0,0,0" MinWidth="100" Click="ButtonNewDamage_Click"/>
        </StackPanel>
                     
        <telerik:RadGridView x:Name="InspectionGrid"
                             AlternationCount="2"
                             AutoGenerateColumns="False"
                             CanUserFreezeColumns="False"    
                             CanUserReorderColumns="False"
                             ColumnWidth="*"
                             EditTriggers="None"
                             Grid.Row="1"
                             Margin="5"
                             MouseDoubleClick="InspectionGrid_MouseDoubleClick"
                             RowIndicatorVisibility="Collapsed"
                             SelectionChanged="InspectionGrid_SelectionChanged"
                             SelectedItem="{Binding Path=CurrentInspection, Mode=TwoWay}"
                             ShowGroupPanel="false">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn UniqueName="DamageCodeDescription"
                                            Header="{lex:LocText Key=Inspection_Space, Dict=InspectionResources, Assembly=Win32Resources}"
                                            DataMemberBinding="{Binding Path=DamageCodeDescription, Mode=OneWay}"/>
                <telerik:GridViewDataColumn UniqueName="ItemCodeDescription"
                                            Header="{lex:LocText Key=Inspection_Part, Dict=InspectionResources, Assembly=Win32Resources}"
                                            DataMemberBinding="{Binding Path=ItemCodeDescription, Mode=OneWay}"/>
                <telerik:GridViewDataColumn UniqueName="ItemDescription"
                                            Header="{lex:LocText Key=Inspection_Addition, Dict=InspectionResources, Assembly=Win32Resources}"
                                            DataMemberBinding="{Binding Path=ItemDescription, Mode=OneWay}"/>
                <telerik:GridViewDataColumn UniqueName="CauseCodeDescription"
                                            Header="{lex:LocText Key=Inspection_Task, Dict=InspectionResources, Assembly=Win32Resources}"
                                            DataMemberBinding="{Binding Path=CauseCodeDescription, Mode=OneWay}" />
                <telerik:GridViewDataColumn UniqueName="TaskCodeDescription"
                                            Header="{lex:LocText Key=Inspection_Finding, Dict=InspectionResources, Assembly=Win32Resources}"
                                            DataMemberBinding="{Binding Path=TaskCodeDescription, Mode=OneWay}" />
                <telerik:GridViewDataColumn UniqueName="ActivityCodeDescription"
                                            Header="{lex:LocText Key=Inspection_Risk, Dict=InspectionResources, Assembly=Win32Resources}"
                                            DataMemberBinding="{Binding Path=ActivityCodeDescription, Mode=OneWay}" />
                <telerik:GridViewImageColumn DataMemberBinding="{Binding Path=AttachmentImage, Mode=OneWay}"
                                            Header="{lex:LocText Key=Inspection_Attachments, Dict=InspectionResources, Assembly=Win32Resources}"
                                            ImageHeight="32"
                                            ImageWidth="32"
                                            IsFilterable="False"
                                            MaxWidth="60"
                                            MinWidth="60"
                                            />
                <telerik:GridViewColumn     CellTemplate="{StaticResource StatusButtons}"
                                            IsFilterable="False"
                                            MaxWidth="120"
                                            MinWidth="120"
                                            />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>     
    </Grid>
</UserControl>

The version of the Telerik WPF components being used: 2010.2.0716.35.

How can we solve this issue?

Kind regards,

Mike
Martin
Top achievements
Rank 1
 answered on 11 Jan 2012
5 answers
114 views
Is there anyway to delay the execution of the query? What I'd like to do is create the datasource. Bind a DataFilter to it, then bind a gridview to the filtered source. But I'd like to not show any results in the gridview until the user has added filters. Basically use this as a searching mechanism.

Is this possible?

Also, are there any samples on how to use this in an MVVM scenario using QueryableEntityCollection<T> in the viewmodel?
Rossen Hristov
Telerik team
 answered on 11 Jan 2012
1 answer
216 views
i had an wpf application contains radtreeview ,i add HierarchicalDataTemplate inside RadTreeview Item Template which contains:

1- RadComboBox 
2- grid contains three textboxs and radcombobox.

when radcomobox selectionchanged the grid bind data into textboxes  according to the selected value in the combobox.

how i can return the current row when RadComboBox is changed, and how i get the contorls inside the row as well.

Regards 


Petar Mladenov
Telerik team
 answered on 11 Jan 2012
2 answers
224 views
I want to get the row in the data loaded event to set the focus on that row.
Vishwajeet
Top achievements
Rank 1
 answered on 11 Jan 2012
1 answer
104 views
Hi there

I'm grouping appointments on a day view by employees (EmployeeResource) so I see all the employee's appointments for the day on a column. Now, in the header template, I would like to show a total of hours already assigned (basically the sum of appointments durations.

The dirty version would be to provide such a total as a property of the EmployeeResource and update my resources on all edited/created/deleted events. However, I'm hoping there's a more elegant approach to this.

Thanks for your advice
Philipp
Yana
Telerik team
 answered on 11 Jan 2012
1 answer
51 views
I am trying to bind a RadGrid to a generic list of custom class through OnNeedDataSource. The grid displays the correct number of rows, however, the values for the fields are empty. I can bind to a datasource object without a problem, but I am going to be adding additional functionality where this method will be necessary. For simplicity sake, I am just trying to bind a single exposed property from the custom class object.

.ASPX

<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1"  runat="server">
          
    </telerik:RadScriptManager>
    <div>
     <telerik:RadGrid runat="server" AllowPaging="True" ID="RadGrid2" OnNeedDataSource="RadGrid2_NeedDataSource" Width="600px" PageSize="8">
            <MasterTableView Width="100%" >
                <Columns>
                     <telerik:GridBoundColumn HeaderText="Project Name" DataField="name" ></telerik:GridBoundColumn>
                </Columns>
                <NoRecordsTemplate>
                    <div style="height: 30px; cursor: pointer;">
                        No items to view</div>
                </NoRecordsTemplate>
                <PagerStyle Mode="NumericPages" PageButtonCount="4" />
            </MasterTableView>
        </telerik:RadGrid>
    </div>
    </form>

ASPX.VB
Imports System
Imports System.Collections.Generic
Imports System.Configuration
Imports System.Data
Imports System.Data.Common
Imports System.Data.SqlClient
Imports System.Web.UI
Imports Telerik.Web.UI
Public Class bookmarks
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  
    End Sub
    Protected Sub RadGrid2_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid2.NeedDataSource
        RadGrid2.DataSource = getBookMarks
    End Sub
    Private ReadOnly Property getBookMarks() As IList(Of project)
        Get
            Dim strSQL As String = "SELECT PROJ_NAME FROM [OPI_TIMESHEETS] o left outer join DCSC_PROJECT d on o.project_number = d.PROJ_NO "
            Dim results As IList(Of project) = New List(Of project)()
            Using connection As IDbConnection = DbProviderFactories.GetFactory("System.Data.SqlClient").CreateConnection()
                connection.ConnectionString = ConfigurationManager.ConnectionStrings("projcentral").ConnectionString
  
                Using command As IDbCommand = connection.CreateCommand()
                    command.CommandText = strSQL
  
                    connection.Open()
                    Try
                        Dim reader As IDataReader = command.ExecuteReader()
                        While reader.Read()
                            Dim name As String = reader.GetValue(reader.GetOrdinal("PROJ_NAME"))
                            results.Add(New project(name))
                        End While
  
                    Catch ex As SqlException
                        results.Clear()
                        'lblmsg.Text = ex.Message
                    End Try
                End Using
            End Using
            lblMsg.Text = results.Count & " items in list"
            Return results
  
        End Get
    End Property
    Class project
  
        Private _projName As String
  
        Sub New(ByVal name As String)
  
            _projName = name
  
        End Sub
#Region "properties"
  
        Private ReadOnly Property Name() As String
            Get
                Return _projName
            End Get
        End Property
  
#End Region
    End Class
  
End Class
Vlad
Telerik team
 answered on 11 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
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?