Telerik Forums
UI for WPF Forum
8 answers
399 views
Hi,
I have a GridView that I need to add some row whenever user reaches to the bottom of the Grid by scrolling down. I couldn't find any event that fires when this happens. I have used PreviewKeyDown but I cannot know if the vertical scrollbar is at the bottom and cannot move further down so I can add more rows to the Grid.
Thanks,
Vlad
Telerik team
 answered on 11 Jan 2011
1 answer
202 views

Hi
In my application each thread is implemented in its own thread like:

public void OpenPartViewer(AbstractPart part)
{
  Thread newWindowThread = new Thread(new ThreadStart(ThreadStartingPoint));
  newWindowThread.SetApartmentState(ApartmentState.STA);
  newWindowThread.IsBackground = true;
  newWindowThread.Start();
  part_ = part;
}
  
private void ThreadStartingPoint()
{
  // Create a new window
  PartViewerMainWindow win = new PartViewerMainWindow(part_);
  win.Closed += (sender1, e1) => win.Dispatcher.InvokeShutdown();
  win.Show();
  // Start the new window's Dispatcher
  System.Windows.Threading.Dispatcher.Run();
}

In one of the dialogs I previously used a ContentControl which I now want to replace with a RadTransitionControl like the above.

<telerik:RadTransitionControl x:Name="PartViewerContent" Grid.Column="1" VerticalContentAlignment="Stretch"     HorizontalContentAlignment="Stretch"
        Content="{Binding ElementName=TreeView, Path=SelectedItem}"
        ContentTemplateSelector="{StaticResource PartViewerContentSelector}">
</telerik:RadTransitionControl>

But after changing to RadTransitionControl I get an error when I change selection in the treeview:

The calling thread cannot access this object because a different thread owns it

I asume it is raised because the transitions is rendered in the main thead but I don't know. And more important. Can I do some magic to make it work.

Miroslav Nedyalkov
Telerik team
 answered on 11 Jan 2011
2 answers
179 views
Hi

Is it possible to add a new row into the gridview when you use paging?
without the paging it works, but our client would like to use paging.

I am using a datatable to fill up the datagrid (I receive this from a dll from a client).

VB

 

 

Dim pagedSource = New QueryableCollectionView(GetDataTable().AsEnumerable.ToList)
Me.radDataPager.Source = pagedSource
Me.radGridView.ItemsSource = pagedSource

XAML

 

 

 

 

<StackPanel 
    Orientation
="Horizontal" 
    HorizontalAlignment
="Center" 
    Margin
="0,5,0,0">

 

 

 

 

 

<telerik:RadButton 
    Width
="150" 
    Content
="Add new row" 
    Margin
="0,0,5,0" 
    
Command="telerikGrid:RadGridViewCommands.BeginInsert" 
    CommandTarget
="{Binding ElementName=RadGridView}" />

 

 

 

 

 

</StackPanel>

 

 

 

 

 

<telerik:RadDataPager 
    x
:Name="radDataPager" 
    PageSize="10" 
    DisplayMode
="All" 
    
IsTotalItemCountFixed="false" 
    
VerticalContentAlignment="Bottom"
</telerik:RadDataPager>

 

 

 

 

 

<telerik:RadGridView 
    x
:Name="radGridView" 
    ItemsSource="{Binding PagedSource, ElementName=radDataPager}" 
    VerticalAlignment="Top" 
    CanUserDeleteRows
="False" 
    CanUserInsertRows="True" 
    CanUserReorderColumns
="False" 
    ShowGroupPanel
="False" 
    AutoGenerateColumns
="False" 
    ShowInsertRow
="True">
</telerik:RadGridView>

 

 

 

 

 

 

Veselin Vasilev
Telerik team
 answered on 11 Jan 2011
1 answer
116 views
sorry, accidentally hit enter!
title should read
"problem loading saved grid settings"

using the provided code from your demo, the 'loadstate' method in the radgridviewsettings file
causes the following exception
{"The binary operator Equal is not defined for the types 'System.Object' and 'System.Boolean'."}

This happens when I load a saved a filter setting, with a column that has boolean types filtered to false or true (nothing works fine).
it seems to arise from:

For Each fds As FilterDescriptorSetting In setting.SelectedDistinctValues
    Dim fd As New Telerik.Windows.Data.FilterDescriptor()
    fd.Member = fds.Member
    fd.[Operator] = fds.[Operator]
    fd.Value = fds.Value
 
    cfd.DistinctFilter.FilterDescriptors.Add(fd)
Next
Me.grid.FilterDescriptors.Add(cfd)


Spent several hours trying to figure this out, any help that can point me in the right direction would be much appreciated!

regards, 
Andrew
Rossen Hristov
Telerik team
 answered on 11 Jan 2011
2 answers
205 views
Hi,

I am using the RadGridView in an MVVM project.  The ViewModel has a property ObservableCollection<T> to which the ItemSource property is bound.  When a I  place a break point in the ViewModel property get, then it is accessed twice.  Am I doing something wrong?  The XAML is below.  Also, what is the best practice when loading data using a pager and ensuring only page size is loaded from the database and not all records (e.g. Take(20));

Regards
Jaco

<Window x:Class="DBAppBestPractice.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:Examples="clr-namespace:DBAppBestPractice"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
                x:Name="root"
                 DataContext="{Binding Main, Source={StaticResource Locator}}"
                >
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Skins/MainSkin.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
     
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
 
        <Border  Grid.RowSpan="2" />
 
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,5,0,0">
            <telerik:RadButton Width="150" Content="Delete selected rows" Margin="0,0,5,0"
                                 Command="telerikGrid:RadGridViewCommands.Delete" CommandTarget="{Binding ElementName=RadGridView1}"  />
            <telerik:RadButton Width="150" Content="Add new row" Margin="0,0,5,0"
                                 Command="telerikGrid:RadGridViewCommands.BeginInsert" CommandTarget="{Binding ElementName=RadGridView1}"  />
            <telerik:RadButton Width="150" Content="Save insert/edit" Margin="0,0,5,0"
                                 Command="telerikGrid:RadGridViewCommands.CommitEdit" CommandTarget="{Binding ElementName=RadGridView1}"  />
            <telerik:RadButton Width="150" Content="Cancel insert/edit"
                                 Command="telerikGrid:RadGridViewCommands.CancelRowEdit" CommandTarget="{Binding ElementName=RadGridView1}"  />
        </StackPanel>
        <telerik:RadGridView x:Name="RadGridView1"
                                                 ItemsSource="{Binding LoadedSuppliers}"
                                                 SelectionMode="Extended"
                                                 AutoGenerateColumns="False"
                                                 Margin="0,5,0,0"
                                                 Grid.Row="1"
                                                 ActionOnLostFocus="None" RowEditEnded="RadGridView1_RowEditEnded" Deleted="RadGridView1_Deleted">
            <telerik:RadGridView.Columns>
                <telerik:GridViewColumn>
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <telerik:RadButton Content="Delete" Command="telerikGrid:RadGridViewCommands.Delete" CommandParameter="{Binding}" />
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewColumn>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Id}" Header="Id" IsReadOnly="True" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Description}" Header="Description" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</Window>
Jaco De Villiers
Top achievements
Rank 2
 answered on 11 Jan 2011
2 answers
60 views
Hello guys ,

My problem is when I add a record via RadGrid (property ShowInsertRow="True") then the result on RadGrid show 2 rows with same data.

Eg.

1. click add new record and fill in some data. > http://img814.imageshack.us/i/85624215.png/

2. after I press ENTER button and click on column header (sorting) I got this result. > http://img708.imageshack.us/i/96015502.png/

3. repeat step 1 and 2. I got this result > http://img214.imageshack.us/i/71641655.png/

XAML :
<telerik:RadGridView x:Name="CodeRadGrid" IsReadOnly="False" AutoGenerateColumns="False" SelectionMode="Extended" telerik:StyleManager.Theme="Office_Blue"
ItemsSource="{Binding PagedSource, ElementName=ctlDataPager}" ShowInsertRow="True" AddingNewDataItem="CodeRadGrid_AddingNewDataItem"
RowEditEnded="CodeRadGrid_RowEditEnded" >
<telerik:RadGridView.Columns>
   <telerik:GridViewSelectColumn />
       <telerik:GridViewDataColumn DataMemberBinding="{Binding aCode}" Header="A Code"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding bCode}" Header="B Code">
    </telerik:GridViewDataColumn>
 </telerik:RadGridView.Columns>
 </telerik:RadGridView>
 <telerik:RadDataPager x:Name="RadDataPager" PageSize="7" DisplayMode="First, Last, Next, Previous, Text" IsTotalItemCountFixed="True" />

C#
private void CodeRadGrid_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
{
    e.NewObject = new CodeObj();
}
 
private void CodeRadGrid_RowEditEnded(object sender, GridViewRowEditEndedEventArgs e)
{
    if (e.EditAction == GridViewEditAction.Cancel)
    {
        return;
    }
    if (e.EditOperationType == GridViewEditOperationType.Insert)
    {
        ((List<CodeObj>)this.RadDataPager.Source).Add( (CodeObj) e.NewData);
    }
}

My RadDataPager.Source  is List<CodeObj>.

Please give me some advice.

Thank you

SweNz

SweNz
Top achievements
Rank 1
 answered on 11 Jan 2011
2 answers
472 views
I have a button in a cell in each row.
When the user clicks the button, I need to transfer data from that row some where else

xaml

      <telerik:RadGridView  x:Name="Search_RadDG" Margin="5,0"
                            ItemsSource="{Binding SearchResults}"
                            SelectionUnit="FullRow"
                             >

        <telerik:RadGridView.Columns>
          <telerik:GridViewColumn Header="Add Candidate" >
            <telerik:GridViewColumn.CellTemplate>
              <DataTemplate>
                <telerik:RadButton Content="Add" Click="RadButton_Click" />
              </DataTemplate>
            </telerik:GridViewColumn.CellTemplate>
          </telerik:GridViewColumn>
        </telerik:RadGridView.Columns>

      </telerik:RadGridView>

VB

 Dim btn As Telerik.Windows.Controls.RadButton
    btn = CType(sender, Telerik.Windows.Controls.RadButton)

    Dim cell As Telerik.Windows.Controls.GridView.GridViewCell
    cell = btn.Parent()

    Dim row As Telerik.Windows.Controls.GridView.GridViewRow
    row = cell.Parent()

    If row IsNot Nothing Then   This is always nothing
      row.IsSelected = True

      Dim can As FoundVoters
      Dim sOffice As String = Nothing
      can = Search_RadDG.CurrentItem

      Dim wcf As New WCF_CommonDataContracts.DataCommon_WCF.WCF_Exception
      With can

        wcf = DistrictData.Candidate_New(StateCbx.SelectedItem,   Countylbx2.SelectedItem,      DistType_lbx.SelectedItem,
                                      ParseDistrictCode(Districts_lbx.SelectedItem), SubDistricts_cbx.SelectedItem,        .Voter_id,
                                            EDate_DP.SelectedDate,             4, sOffice)
      End With

      Candidate_List_Set()
    End If


Michael Luna
Top achievements
Rank 1
 answered on 10 Jan 2011
3 answers
113 views
Is the grid shown in the attached image possible with the Telerik ?

I'm prepared to give up on displaying column headers on each group (http://www.telerik.com/community/forums/wpf/gridview/repeating-column-headers-in-every-group.aspx)

However, If I can't repeat the column headers further down the grid, i could possibly fake grouping using 'normal' rows and style selectors.  I would then need to be able to merge cells in two adjacent columns like in the Xceed or ComponentOne grids. Is this possible?

Thanks
Pete
Peter Chapman
Top achievements
Rank 1
 answered on 10 Jan 2011
1 answer
452 views
I want to be to be able to add textbox to the a rad window that is generated dynamically, but i can't see anything that will allow me to do this.
I was expecting to see some thing like ' Window.Child.Add();'

Can anyone help please?

RadWindow[] window = new RadWindow[5];
               for (int i = 0; i < 5; i++)
               {
                   window[i] = new RadWindow();
                      
                   window[i].Width = 250;
                   window[i].Height = 250;
                   window[i].Name = "Apples" + i;
                   window[i].Show();
               }
Simon Allport
Top achievements
Rank 2
 answered on 10 Jan 2011
1 answer
113 views
Hi, 

I have created raddocking tool window from InitialPosition = "FloatingOnly" of RadSplitContainer.
I would like to prevent resizing tool window from user.

Thanks.
Jenny
Konstantina
Telerik team
 answered on 10 Jan 2011
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
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
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
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
VirtualKeyboard
HighlightTextBlock
Security
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?