Telerik Forums
UI for WPF Forum
5 answers
185 views
Hi,
Is there an event I can handle to determine when a new RadPaneGroup has been added to a RadDocking control?
Currently, I'm using RadPaneGroup.GotFocus event to determine which pane is currently selected.  This works fine for the groups that were in place in the XAML.  However, if I drag/drop a RadPane into a new container/group, the dynamically created RadPaneGroup is not "wired" up for GotFocus, and so I am unable to track selected pane(s) in the dynamic group.  Is there a way to track when a RadPaneGroup is dynamically added to a RadDocking instance?
Is there another way I should be doing this?

Thanks.
Konstantina
Telerik team
 answered on 11 Jan 2011
3 answers
295 views
I am using a RadComboBox standalone and inside the RadDataGrid.  The combo items displayed contains pictures as well as text.  I am using a StackPanel to contain the Image and Text items of the DataTemplate.

1) When the combo drops down it does not display multiples (eg. 7) of the items.  It displays something like 6.5 items.  The bottom item is clipped.
2) When I scroll to the bottom of the list there is about 0.5 of an item left in blank space.

Although the Combo works fine, the display does not look neat.  How can I solve the above 2 problems?


 
Konstantina
Telerik team
 answered on 11 Jan 2011
8 answers
393 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
199 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
175 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
112 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
200 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
59 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
463 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
111 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?