Telerik Forums
UI for WPF Forum
5 answers
2.0K+ views
Hi. I'm developing a form on which the user can select one of many reports to show, and I have two questions on the GridView:

  1. Do you always have to specify a Columns collection? I mean, because I can have many different reports for the same GridView, I want to be able to show them all without having to specify the columns individually.
  2. How do you programatically hide or show a column at a specific index or with a specific header? My user wants to be able to hide some columns before exporting the report results, so I'm planning on showing him a CheckBox list with the columns, so he can choose which ones to show/hide.

Thanks a lot.
Vlad
Telerik team
 answered on 13 Sep 2010
6 answers
214 views

 

 

 

I have following column amongst other columns:

...

<
grid:GridViewDataColumn IsReadOnly="False" IsSortable="False" Header="Comment"

 

 

 

                         DataMemberBinding="{Binding Comment}" MaxWidth="250" IsResizable="False" >

 

 

 

 

    <grid:GridViewDataColumn.CellEditTemplate>

 

 

 

 

        <DataTemplate>

 

 

 

 

            <TextBox Text="{Binding Comment}" MaxLength="50" />

 

 

 

 

        </DataTemplate>

 

 

 

 

    </grid:GridViewDataColumn.CellEditTemplate>

 

 

 

 

</grid:GridViewDataColumn>

...

Issue:

When there is more than one row in the grid, editing of this cell can be ended in whatever way (by focusing on some other field, pressing enter... etc.) and the grid will retain the value entered. Such value will also be updated into the database by:

 

private

 

 

void radGridView1_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
{...}


However, when there is only one row in the grid, pressing enter to end the cell edit works for retaining the value just entered for the cell but not triggering "CellEditEnded". Therefore, the value entered is not being put into the database...

Is there anyway someone help me with this?

Thanks for your time in advance,

K

 

 

 

Maya
Telerik team
 answered on 13 Sep 2010
1 answer
59 views
i need to create quadrant-style gauge and semicircle gauge dynamically using vb.net or c#.net code please help me out..!!

Regards,
Kapil Garg
Andrey
Telerik team
 answered on 13 Sep 2010
6 answers
356 views
Hello :)

I have a problem when I try to add a new row to the gridview,  

In short, I have an empty gridview and the event RowEditEnded fires before the new row appears for editing and without the user presses enter when adding a new row into the gridview when the grid view is not empty (when the gridview is empty RowEditEnded event fires after the user presses enter).

My scenario is the following:

When the gridview is empty, I use the BeginInsert() method to insert a new row, then the handler for the AddingNewDataItem gets executed, then appears a new row on the gridview with the first cell on edit mode, then I fill all the cells on the gridview and after that I hit enter, after I press enter the handler for the RowEditEnded event gets executed with e.EditOperationType==Insert  and e.EditAction==Commit, (in this handler I add the new row to a data base) and so far so well, but when I want to insert an other new row, the handler for the AddingNewDataItem event gets executed and just after that (and here is the problem) the handler for the RowEditEnded event gets executed with e.EditOperationType==Insert and e.EditAction==Commit (without the new row appears for editing and without the user presses enter) and after that the row appears on the grid view ready for editing (also for default appears the last cell of the row in edit mode and for this reason I have to press esc and go to the first cell of the row), so the RowEditEnded event fires before the new row appears for editing and without the user presses enter.

Is this the default behavior or am I doing something wrong? 

void NuevoProveedorButton_Click(object sender, RoutedEventArgs e)
{
            this.ProveedoresGridView.BeginInsert();
}
 
void ProveedoresGridView_AddingNewDataItem(object sender, GridViewAddingNewEventArgs e)
{
            e.NewObject = new Proveedor_TipoProveedor();
}




Maya
Telerik team
 answered on 13 Sep 2010
1 answer
111 views
Hi,

I'm using a RadTimePicker in a ControlTemplate and would like to set "DateTimeWatermarkContent" to another value. Unfortunately the value is not used and shows still "Enter time". Also I would like to change the Header on the drop down clock which has value "Clock".

Here the code:

<ContentControl Grid.Row="1" Grid.Column="1" Width="80" Style="{StaticResource styleContentControlTime}" Content="{Binding OfficeHour.MondayOpen, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" ></ContentControl>

here the style:

 <Style x:Key="styleContentControlTime" TargetType="ContentControl">
        <Setter Property="IsTabStop" Value="false"></Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding  Path=InEditMode}" Value="true">
                <Setter Property="ContentControl.Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                <telerik:RadTimePicker SelectedValue="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContentControl}}, Path=Content, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
                                                       Margin="10,3" DateTimeWatermarkContent="" >
                                </telerik:RadTimePicker>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </DataTrigger>

            <DataTrigger Binding="{Binding  Path=InEditMode}" Value="false">
                <Setter Property="ContentControl.Template">
                    <Setter.Value>
                        <ControlTemplate>
                            <Grid >
                                <TextBlock Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContentControl}}, Path=Content, Converter={StaticResource dateTimeToTimeStringConverter}}"
                                           Style="{StaticResource styleTextBlock}" VerticalAlignment="Center"></TextBlock>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </DataTrigger>
        </Style.Triggers>
    </Style>

regrads,
Timo
Kaloyan
Telerik team
 answered on 13 Sep 2010
7 answers
396 views
Hi,

I've been evaluating the WPF charting component and am really struggling to find out how to change the colour palette for a pie chart. Can anyone help?

Also noticed that when you resize the width of a window containing a 3D pie chart, the chart will scale, but if you adjust the height, it doesn't. Am I doing something wrong? Code below:

<Window x:Class="Telerik1.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    xmlns:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
    Title="Window1" Height="600" Width="800" Loaded="ExampleControl_Loaded" Unloaded="ExampleControl_Unloaded">  
    <Window.Resources> 
        <Style TargetType="{x:Type telerik:RadChart}">  
            <Setter Property="telerik:Theming.Theme">  
                <Setter.Value> 
                    <telerik:VistaTheme/> 
                </Setter.Value> 
            </Setter> 
        </Style> 
        
    </Window.Resources> 
    <Grid> 
        <telerik:RadChart x:Name="RadChart1" /> 
    </Grid> 
</Window> 
 


Thanks,
Gary.
Giuseppe
Telerik team
 answered on 13 Sep 2010
1 answer
119 views
If I call this code in a virtualized scroll viewer with 3000 thousand items, the ScrollViewer won't move even 25% of the number of times I call it:

for (int i = 0; i < 1000; i++)
{
    radTreeView.ScrollViewer.LineDown();
}

For some reason it stops at some point. Let me know if there's a way to fix this. I want to be able to move the RadTreeView a certain amount of times when the user clicks on a button, but this is preventing me from doing it, some times the amount is very large as in the example code above.

Thanks.
Miro Miroslavov
Telerik team
 answered on 13 Sep 2010
1 answer
122 views

Hi,
I have the following combobox that I am trying to use essentially as an edit field and the dropdown list as a collection of predefined values that the user can select.

The problem is that the 'Clear' button in the dropdown list (that shows up due to the 'ClearSelectionButtonVisibility' property) does not always clear the text. It works fine if I select an item from the dropdown list before the clear, but if I type in text that does not match any of the items then it does nothing.
Best regards,
Pete

 


<
telerik:RadRibbonComboBox

 

 

CanAutocompleteSelectItems="True"

 

 

CanKeyboardNavigationSelectItems="True"

 

 

ClearSelectionButtonVisibility="Visible"

 

 

EmptyText="Enter text"

 

 

FilteringMode="Contains"

 

 

IsEditable="True"

 

 

IsFilteringEnabled="True"

 

 

IsReadOnly="False"

 

 

ItemsSource="{Binding Source={x:Static local:Core.App}, Path=SummaryTextForAllGames, Mode=OneWay}"

 

 

MinWidth="250"

 

 

OpenDropDownOnFocus="True"

 

 

StaysOpenOnEdit="True"

 

 

Text="{Binding Path=Value, Mode=TwoWay}"

 

 

TextSearchMode="Contains"

 

 

VerticalAlignment="Center"

 

 

/>

 

Valeri Hristov
Telerik team
 answered on 13 Sep 2010
3 answers
300 views
When I use the page down key or the mouse wheel to scroll down a virtualized RadTreeView, I get this bug:



The RadTreeViewItems that disappear are actually null when I get in to debug. Why does this happen? It's causing me a problem where a RadTreeViewItem I'm tracking suddenly disappears from memory, even though I have a few other pointers referencing it, it just goes away.

Let me know if there is a solution to this.

Thanks!

Here's my code:

XAML:
<Window x:Class="TreeViewComparison.Window1"
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
    Title="Window1" Height="305" Width="627">
    <Window.Resources>
        <HierarchicalDataTemplate x:Key="ItemTemplate" ItemsSource="{Binding SubItems}">
            <TextBlock Text="{Binding Header}"/>
        </HierarchicalDataTemplate>
 
        <Style TargetType="telerik:RadTreeViewItem">
            <Setter Property="IsExpanded" Value="True"/>
        </Style>
         
    </Window.Resources>
     
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <telerik:RadTreeView x:Name="radTreeView"
                             Grid.Row="0"
                             IsVirtualizing="True"
                             ItemTemplate="{StaticResource ItemTemplate}" />
        <Button x:Name="buttonBreakpoint" Grid.Row="1" Margin="8" Content="Breakpoint" Click="buttonBreakpoint_Click" />
    </Grid>
</Window>

C#:

using System;
using System.Collections.ObjectModel;
using System.Windows;
 
namespace TreeViewComparison
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
 
            this.radTreeView.ItemsSource = GenerateItems();
        }
 
        private ObservableCollection<DataItem> GenerateItems()
        {
            ObservableCollection<DataItem> result = new ObservableCollection<DataItem>();
 
            for (int i = 0; i < 10; i++)
            {
                DataItem item = new DataItem(String.Format("Item {0}", i));
                for (int j = 0; j < 100; j++)
                {
                    item.SubItems.Add(new DataItem(String.Format("Item {0}.{1}", i,j)));
                }
 
                result.Add(item);
            }
            return result;
        }
 
        class DataItem
        {
            public DataItem(string header)
            {
                this.SubItems = new ObservableCollection<DataItem>();
                this.Header = header;
            }
            public string Header { get; set; }
 
            public ObservableCollection<DataItem> SubItems { get; set; }
        }
         
        private void buttonBreakpoint_Click(object sender, RoutedEventArgs e)
        {
         
        }
    }
}
Hristo
Telerik team
 answered on 13 Sep 2010
1 answer
35 views
Hello:

Quick question: Is it possible to drag a RadPane from one RadDocking (source) to another one (target)? Can I dock it to the target RadDocking?

thanks
Konstantina
Telerik team
 answered on 13 Sep 2010
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?