Telerik Forums
UI for WPF Forum
1 answer
92 views
Hi,

I am facing problem while rebinding the grid.

In the XAML,

<

 

 

telerik:RadGridView x:Name="RadGridView1" ItemsSource="{Binding Path=Table, Mode=TwoWay,
UpdateSourceTrigger
=PropertyChanged}" GridLinesVisibility="Both" IsReadOnly="True"

 

 

 

CanUserFreezeColumns="False" RowIndicatorVisibility="Collapsed" CanUserReorderColumns="False"

 

 

 

ShowGroupPanel="False" HorizontalAlignment="Left" SelectionMode="Extended" SelectionUnit="Cell"
BorderThickness
="0">

 

<

 

 

telerik:RadGridView.FilterDescriptors>
<telerik:FilterDescriptor Member="ParentID" Operator="IsEqualTo" Value="0"/>
</telerik:RadGridView.FilterDescriptors>

 

 

 

 

 

 

<

 

 

telerik:RadGridView.ChildTableDefinitions>
<telerik:GridViewTableDefinition>
<telerik:GridViewTableDefinition.Relation>
<telerik:TableRelation IsSelfReference="True">
<telerik:TableRelation.FieldNames>
<telerik:FieldDescriptorNamePair ParentFieldDescriptorName="ServiceID" ChildFieldDescriptorName="ParentID"/>
</telerik:TableRelation.FieldNames>
</telerik:TableRelation>
</telerik:GridViewTableDefinition.Relation>
</telerik:GridViewTableDefinition>
</telerik:RadGridView.ChildTableDefinitions>
</telerik:RadGridView>

In the ViewModel,

 

private

 

 

DataTable _table;
public DataTable Table
{
get { return _table; }
set
{
_table =
value;
RaisePropertyChanged(() =>
this.Table);
}
}

 

 

[

 

ImportingConstructor]
public MatrixViewModel(IEventAggregator eventAggregator)
{
this.TabModel = new TabModel { Title = "Matrix" };

if (eventAggregator != null)
eventAggregator.GetEvent<
MatrixReloadEvent>().Subscribe(OnContractCreatedOrLoaded);
}

 

 

 


private
void OnContractCreatedOrLoaded(ContractCreatedOrLoadedEventArgs args)

 

{

 

DataTable dtOutput = new DataTable();
..buliding the datatable and assigning to the Table property
}

 

 

From the other screen I am calling the event "OnContractCreatedOrLoaded" while adding new items. For the first time (add 1 or n number of items) and view the grid screen. It works perfectly (Grid will have only one row - ParentID = 0).

Now add 1 new item ("OnContractCreatedOrLoaded" event will be fired) and see the grid, it binds all the rows in the datatable without filtering or hierarchy (grid is having all the rows instead of showing ParentID = 0)

Any help appreciated.

Thanks,
Ramasamy

Ramasamy
Top achievements
Rank 1
 answered on 06 Oct 2011
1 answer
124 views
Hi,

how to get the Telerik.Windows.Input namespace? I have already added Telerik.Windows.Controls.dll but i cannot include the Input namesapce.

Thanks,
Ramasamy
Ramasamy
Top achievements
Rank 1
 answered on 06 Oct 2011
3 answers
175 views
Greetings-
I seem to be having a problem with the RadRichTextBox with regard to the MaxWidth and MinWidth properties. We have created a re-usable control callled HTMLEditor.xaml that has the RadRichTextBox contained in a grid. See the code below

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition MinWidth="500" />
        </Grid.ColumnDefinitions>
        <Grid Grid.Row="0" Grid.Column="0" MinWidth="500" HorizontalAlignment="Stretch">
            <telerik:RadRichTextBox LayoutMode="Flow" x:Name="editor" AllowDrop="True" Drop="editor_Drop" ShowComments="False" MinHeight="50" MaxHeight="100" BorderBrush="#FFADADAD"
                                   MinWidth="500" BorderThickness="1" IsSelectionMiniToolBarEnabled="False" IsContextMenuEnabled="True" IsInHeaderFooterEditMode="False">
            </telerik:RadRichTextBox>
        </Grid>
    </Grid>

This control gets re-used in a few instances and has varying MaxWidth and MinWidth properties in 3 different cases. I seem to having a problem with each instance of the RadRichTextBox control...they do not re-size to the resolution.

<GroupBox Margin="5" Padding="5" MinWidth="614" Header="Stem and/or Stimulus" Foreground="#FF000000">
           <common:HtmlEditor Name="htmlStem" GotFocus="htmlEditor_GotFocus" MinHeight="100" Margin="0" Padding="0" />
           </GroupBox>

Can you provide some help with this?
Thanks,
Strasz
Iva Toteva
Telerik team
 answered on 05 Oct 2011
4 answers
173 views
An app I'm working on needs several mutually-exclusive User Controls; each of which has a child RadGridView.   To make the User Control's child controls scroll properly horizontally, I had to wrap all of each User Control's child controls in a ScrollViewer.   (I tried various horizontal scroll settings on each grid itself, but never found one that worked well and also consistently stretched the grid to match the parent UserControl's width dimension).

Before adding the ScrollViewer containers, I had already implemented "Find/FindNext" logic which positioned the resulting row within the appropriate RadGridView's viewport by calculating the desired new top row for the RadGridView, using the Grid's ScrollIntoViewAsync() method to get the right row visible on top, and setting the Grid's CurrentItem and Selecteditem properties to that row item.

But with the enclosing ScrollViewer, the GridView thinks more rows are visible than really are.  So the selected rows remain outside of the ScrollViewer's viewport.

 I realize this is a virtualization issue, but am not sure of the best way to address it.   (The GridView may contain thousands of rows.   I'd rather not have them all load at once as I'd expect if I tried to disable virtualization for the grid as a whole).

Since the ScrollViewer is needed only to accommodate horizontal width, there may be a way to limit the outer ScrollViewer's behavior to the horizontal dimension.

Does anyone have ideas about the best way to address this?
Thanks!
-Bob
BRiddle
Top achievements
Rank 1
 answered on 05 Oct 2011
3 answers
101 views
Hi I am trying to apply custom Bubble Series Style through BubbleSeriesDefinition, using ItemStyle property. However, when I apply default (Blend generated) bubble template, bubble data points are not visible at all. The visual tree contains the series and the Bubble with my custom style however the bubble points are not visible on the chart area. I tried to apply the template declarative (XAML) as well as in code behind - no success.
My team and I are using WPF Telerik Controls Versioin 2011.1.419.35

XAML
<UserControl
   <UserControl.Resources>
     <Style x:Key="CustomBubbleStyle" TargetType="{x:Type telerik:Bubble}">
          <Setter Property="Diameter" Value="80"/>
          <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type telerik:Bubble}">
            <Canvas x:Name="PART_MainContainer" RenderTransformOrigin="{TemplateBinding RelativeCenterPoint}">
                              <Canvas.RenderTransform>
                   <ScaleTransform ScaleY="0" ScaleX="0"/>
                </Canvas.RenderTransform>
                <Path x:Name="PART_BubbleElement" Fill="Green" Data="{TemplateBinding ItemGeometry}" />
                 
                                <Path Data="M108.5,54.25C108.5,84.211448 84.211448,108.5 54.25,108.5 24.288552,108.5 0,84.211448 0,54.25 0,24.288552 24.288552,0 54.25,0 84.211448,0 108.5,24.288552 108.5,54.25z" Height="{TemplateBinding Diameter}" Canvas.Left="{TemplateBinding Left}" Stretch="Fill" SnapsToDevicePixels="True" Stroke="Transparent" StrokeThickness="0" Canvas.Top="{TemplateBinding Top}" Width="{TemplateBinding Diameter}">
                                             <Path.Fill>
                                                   <RadialGradientBrush GradientOrigin="0.5,0.5">
                                                         <GradientStop Color="#66FFFFFF" Offset="0.86"/>
                             <GradientStop Color="Transparent" Offset="0.85"/>
                             <GradientStop Color="#26FFFFFF"/>
                            </RadialGradientBrush>
                                </Path.Fill>
                 </Path>
            </Canvas>
        </ControlTemplate>
    </Setter.Value>
    </Setter>
</Style>
</UserControl.Resources>
 
<telerik:RadChart SnapsToDevicePixels="True" FontSize="9" Height="200" Width="400"
     ItemsSource="{Binding Source={StaticResource SampleDataSource}, Path=Collection}">
<telerik:RadChart.DefaultView>
       <telerik:ChartDefaultView>
           <telerik:ChartDefaultView.ChartArea>
                        <telerik:ChartArea NoDataString="Isufficient Information" Style="{StaticResource ChartAreaStyle}">
                   <telerik:ChartArea.AxisY>
                       <telerik:AxisY TextBlock.Foreground="LightGray"  MinorTickPointMultiplier="5" ExtendDirection="Up" MajorGridLinesVisibility="Visible"
                           MinorTicksVisibility="Hidden" DefaultLabelFormat="0">
                       </telerik:AxisY>
                   </telerik:ChartArea.AxisY>
                       <telerik:ChartArea.AxisX>
                                <telerik:AxisX MinValue="0" TextBlock.Foreground="LightGray" IsZeroBased="True" LayoutMode="Auto" TextBlock.FontSize="5" MajorGridLinesVisibility="Visible"
                           MinorTicksVisibility="Hidden">
                       </telerik:AxisX>
                   </telerik:ChartArea.AxisX>
               </telerik:ChartArea>
           </telerik:ChartDefaultView.ChartArea>
       </telerik:ChartDefaultView>
   </telerik:RadChart.DefaultView>
             <telerik:RadChart.SeriesMappings>
                <telerik:SeriesMapping>
                    <telerik:SeriesMapping.SeriesDefinition>
                        <telerik:BubbleSeriesDefinition BubbleSizeRelative="False" ItemStyle="{StaticResource CustomBubbleStyle}"/>
                    </telerik:SeriesMapping.SeriesDefinition>
                    <telerik:SeriesMapping.ItemMappings>
                        <telerik:ItemMapping DataPointMember="XValue" FieldName="XValue"/>
                        <telerik:ItemMapping DataPointMember="YValue" FieldName="YValue"/>
                        <telerik:ItemMapping DataPointMember="Label" FieldName="ID"/>
                    </telerik:SeriesMapping.ItemMappings>
                </telerik:SeriesMapping>
                 
                <!-- Regression Line -->
                <telerik:SeriesMapping ItemsSource="{Binding Source={StaticResource RegressionLine}, Path=Collection}">
                    <telerik:SeriesMapping.SeriesDefinition>
                        <telerik:LineSeriesDefinition />
                    </telerik:SeriesMapping.SeriesDefinition>
                    <telerik:ItemMapping DataPointMember="XValue" FieldName="Property1"/>
                    <telerik:ItemMapping DataPointMember="YValue" FieldName="Property2"/>
                </telerik:SeriesMapping>
                </telerik:RadChart.SeriesMappings>
                </telerik:RadChart>
 
</UserControl>
Evgenia
Telerik team
 answered on 05 Oct 2011
1 answer
87 views
For some reason I can't seem to get a hierarchical layout using my datatables. My dataset already contains the correct relation between  my two tables. Do you have an example of how to do this. I have tried both the DataLoading method and HierachicalDataTemplate method and neither one seems to work. I can get the RowLoaded event to show the expander because DataRow.GetChildRows returns records.
Thanks,
Rod
Vlad
Telerik team
 answered on 05 Oct 2011
1 answer
163 views
GeographicToLogical gives us value from 0 to 1. I am using this method to project the points using Mercator projection but I want the result in meters. How can we convert the 0-1 value to meters?
Andrey
Telerik team
 answered on 05 Oct 2011
1 answer
123 views
How to calculate area enclosed by MapPolygon?
Andrey
Telerik team
 answered on 05 Oct 2011
0 answers
168 views
Hello,

   I'm using the telerik Radgrid in our project, which is used to display search result of data having more than 20000 rows and the data rebind to the grid every time the user change the search criteria and click on search button.

As the data binded to the grid is too much, I have implemented VirtualQueryableCollectionView, to overcome the performance issues while loading.

Everything works fine, when the grid get loaded for the first time, but after loading if I scroll down to some far point let's say in middle
and never move the scroller again and search again by changing the search criteria (which will return the less no. of rows for eg. 5 or 6)
then in that case the ItemsLoading event of VirtualQueryableCollectionView fires and even the data loads to the grid but the rows are not visible to the user, it seems as if no data has been loaded in the grid.

But actually the data got binded, and if I use my mouse cursor to scroll (though their is no scroll bar) the rows become visible and which seems to be abnormal behavior of the grid.

The similar issue is already posted in the forum, but in that thread their is no response from the Telerik Team for solution. ( Link for Ref. http://www.telerik.com/community/forums/wpf/gridview/radgridview-with-virtualqueryablecollectionview-loaded-via-wcf-problem.aspx )

I have added code snippets for your reference, showing how I am defining the grid and binding it.

Please revert back as soon as possible.

Thanks
Ramnadh
///This is the xaml code for defining the grid columns and style for List View
 
<telerik:RadBusyIndicator DisplayAfter="0"  x:Name="radBusyIndicator" Background="Transparent" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" >
                    <telerik:RadGridView Name="grid" IsReadOnly="True" CanUserDeleteRows="False" CanUserInsertRows="False" CanUserSortColumns="False" ColumnWidth="*" Height="Auto" Width="Auto" ItemsSource="{Binding}" >
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn Name="agentCodeCol"  DataMemberBinding="{Binding AgentCode}" HeaderTextAlignment="Right" TextAlignment="Right" Header="Agent Code" />
                            <telerik:GridViewDataColumn Name="lastNameCol" DataMemberBinding="{Binding LastName}" Header="Last Name" />
                            <telerik:GridViewDataColumn Name="firstNameCol" DataMemberBinding="{Binding FirstName}" Header="First Name" />
                            <telerik:GridViewDataColumn Name="cityCol" DataMemberBinding="{Binding city}" Header="City" />
                            <telerik:GridViewDataColumn Name="stateCol" DataMemberBinding="{Binding StateCode}" Header="State" />
                            <telerik:GridViewDataColumn Name="zipCol" DataMemberBinding="{Binding Zip}" Header="ZIP" TextAlignment="Right" HeaderTextAlignment="Right" />
                            
                            <telerik:GridViewDataColumn Name="editProfileCol" Header="Edit Profile" HeaderTextAlignment="Center" >
                                <telerik:GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button x:Name="editProfileBtn" Content="Edit"  Click="OnEditProfileBtnClick" Width="70" Height="16" />
                                    </DataTemplate>
                                </telerik:GridViewColumn.CellTemplate>
                            </telerik:GridViewDataColumn>
                            <telerik:GridViewDataColumn Name="swapInCol" Header="Swap In" >
                                <telerik:GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button Content="Swap In" Style="{StaticResource buttonStyle}" Click="OnSwapInBtnClick" Width="70" Height="16"/>
                                    </DataTemplate>
                                </telerik:GridViewColumn.CellTemplate>
                            </telerik:GridViewDataColumn>
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </telerik:RadBusyIndicator>
 
 
<Style x:Key="lvStyle" TargetType="{x:Type ListView}">
            <Setter Property="VirtualizingStackPanel.IsVirtualizing" Value="True"/>
            <Setter Property="VirtualizingStackPanel.VirtualizationMode" Value="Recycling"/>
            <Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="True"/>
            <Setter Property="ListView.ItemsSource" Value="{Binding}"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsLoading}" Value="True">
                    <Setter Property="ListView.Cursor" Value="Wait"/>
                    <Setter Property="ListView.Background" Value="LightGray"/>
                </DataTrigger>
            </Style.Triggers>
 </Style>
 
 
//Code for binding the grid using VirtualQueryableCollectionView
 
DataTable totalRowCountDT = searchResDS.Tables[0];   //Getting the table from Database
                    if (totalRowCountDT != null && totalRowCountDT.Rows.Count > 0 && totalRowCountDT.Rows[0][0] != DBNull.Value) {
                        int numItems = Convert.ToInt32(totalRowCountDT.Rows[0][0]);
                        AgentProvider agentProvider = new AgentProvider(numItems, 0);
                        var view = new VirtualQueryableCollectionView<Agent>() { LoadSize = 500, VirtualItemCount = agentProvider.FetchCount() };
                        view.ItemsLoading += (s, args) => {
                            ShowOrHideProgressBar(true);
                            view.Load(args.StartIndex, agentProvider.FetchRange(args.StartIndex, args.ItemCount));
                            ShowOrHideProgressBar(false);
 
                                                                                
                        };
                        
                        grid.DataContext = view;
 
 
//Method to show and hide the RadBusyIndicator
 public void ShowOrHideProgressBar(bool showOrHide) {
            this.radBusyIndicator.IsBusy = showOrHide;
        }
 
 
//Class to provide data for Grid to while scrolling
   
 public class AgentProvider : IItemsProvider<Agent> {
        private readonly int _count;
        private readonly int _fetchDelay;
 
        /// <summary>
        /// Initializes a new instance of the <see cref="DemoCustomerProvider"/> class.
        /// </summary>
        /// <param name="count">The count.</param>
        /// <param name="fetchDelay">The fetch delay.</param>
        public AgentProvider(int count, int fetchDelay) {
            _count = count;
            _fetchDelay = fetchDelay;
        }
 
        /// <summary>
        /// Fetches the total number of items available.
        /// </summary>
        /// <returns></returns>
        public int FetchCount() {
            Trace.WriteLine("FetchCount");          
            return _count;
        }
 
        /// <summary>
        /// Fetches a range of items.
        /// </summary>
        /// <param name="startIndex">The start index.</param>
        /// <param name="count">The number of items to fetch.</param>
        /// <returns></returns>
        public IList<Agent> FetchRange(int startIndex, int count) {
            Trace.WriteLine("FetchRange: " + startIndex + "," + count);
            AgentEntity agentEntity = new AgentEntity();
            DataSet searchResDS = agentEntity.GetAllAgentDetails(
                                                                        VirtualizationHelper.AgetStruct.LastName
                                                                   ,    VirtualizationHelper.AgetStruct.FirstName
                                                                   ,    VirtualizationHelper.AgetStruct.AgentCode
                                                                   ,    VirtualizationHelper.AgetStruct.Email
                                                                   ,    VirtualizationHelper.AgetStruct.Phone
                                                                   ,    VirtualizationHelper.AgetStruct.Zip
                                                                   ,    VirtualizationHelper.AgetStruct.StateId
                                                                   ,    VirtualizationHelper.AgetStruct.UserId
                                                                   ,    VirtualizationHelper.AgetStruct.IsCurrentUsrHomeOffUsr
                                                                   ,    startIndex
                                                                   ,    startIndex+count
                                                                   , UserInfo.IsCurrentUserLoggedInUser);
            DataTable agenttDT = searchResDS.Tables[1];
            List<Agent> list = new List<Agent>();
            foreach (DataRow row in agenttDT.Rows) {
                Agent agent = new Agent {
                        AgentCode = Convert.ToString(row["AgentCode"])
                    ,   LastName = Convert.ToString(row["LastName"])
                    ,   FirstName = Convert.ToString(row["FirstName"])
                    ,   city = Convert.ToString(row["city"])
                    ,   StateCode = Convert.ToString(row["StateCode"])
                    ,   Zip = Convert.ToString(row["Zip"])
                    ,   GACode = Convert.ToString(row["GACode"])
                    ,   AgentGuid = Convert.ToString(row["AgentGuid"])
                };
                list.Add(agent);
            }
            return list;
        }
    }


 
Ram
Top achievements
Rank 1
 asked on 05 Oct 2011
2 answers
161 views
<telerik:RadWindow x:Class="RadToolBar.View"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="550">
    <Grid>
        <StackPanel>
                <telerik:RadToolBar>
                    <telerik:RadComboBox Name="graphModes" Width="250" Height="22" Margin="3">
                        <ComboBoxItem>One</ComboBoxItem>
                        <ComboBoxItem>Two</ComboBoxItem>
                        <ComboBoxItem>Three</ComboBoxItem>
                     </telerik:RadComboBox>
                </telerik:RadToolBar>
        </StackPanel>
    </Grid>
</telerik:RadWindow>

If using normal Window - all working nice. But i want use RadWindow!
Sergey
Top achievements
Rank 1
 answered on 05 Oct 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?