Telerik Forums
UI for WPF Forum
1 answer
190 views
Hi

I need a hint how to implement the editing of multiple cells with one operation? Using MS-DataGrid I'm waiting in the PreviewKeyDown event for Key.Enter and then copy the entered value from the visual tree to all selected cells.

Is there an easier way to do this with the RadGridView?

UPDATE: Found the RowEditEnded by my self. The only left issue was to leave the edit mode of the next cell after hitting enter. Solved this in the PreviewKeyUp event.
Yoan
Telerik team
 answered on 08 Nov 2013
1 answer
599 views
My WPF question/problem is similar to the already answered question in this thread for WinForms: http://www.telerik.com/community/forums/winforms/gridview/scroll-bar-position-after-refreshing-grid.aspx

The problem is I don't have a way to get the Grid or Scrollbar controls/elements in the code behind because we are using a strict MVVM approach so this solution does not fix the problem I am having in WPF.

If there are any other tips or tricks you all might have that would work for MVVM, it would be much appreciated. This is one of the last problems we are having with a couple of our windows with large sets of data in a RadGridView. While the user is viewing data
in the Grid, I want the Grid to continue updating AND preserve the scrollbars position within the Grid -- instead of the scrollbars position returning to the top of the Grid. Thanks in advance for any help or guidance!

J
Jacob
Top achievements
Rank 1
 answered on 07 Nov 2013
2 answers
252 views
My grid is displaying aggregate results in the group headers which I want to remove; I only wish to display the aggregates in the column footers.  My WPF form uses the following;

<Window x:Class="MainWindow"
    xmlns:local="clr-namespace:ProjectRigAnalysis"
    Title="MainWindow"
    Height="auto"
    Width="auto"
    WindowStartupLocation="CenterScreen">
     
    <Window.Resources>
        <local:NumberToFixedStringConverter x:Key="NumberToFixedString" />
        <local:GridViewTemplateSelector x:Key="gridViewTemplateSelector">
            <local:GridViewTemplateSelector.belowRequirement>
                <DataTemplate>
                    <TextBlock Text="{Binding RequiredRigYrs, Converter={StaticResource NumberToFixedString}, ConverterParameter=0.00}"
                        Foreground="Red"
                        TextAlignment="Right" />
                </DataTemplate>
            </local:GridViewTemplateSelector.belowRequirement>
            <local:GridViewTemplateSelector.meetsRequirement>
                <DataTemplate>
                    <TextBlock Text="{Binding RequiredRigYrs, Converter={StaticResource NumberToFixedString}, ConverterParameter=0.00}"
                        Foreground="Green"
                        TextAlignment="Right" />
                </DataTemplate>
            </local:GridViewTemplateSelector.meetsRequirement>
        </local:GridViewTemplateSelector>
        <Style TargetType="telerik:GroupHeaderRow">
            <Setter Property="ShowGroupHeaderColumnAggregates" Value="False" />
            <Setter Property="ShowHeaderAggregates"  Value="False" />
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <telerik:RadGridView Name="rgvWell"
            Grid.Row="0"
            Grid.Column="0"
            HorizontalAlignment="Stretch"
            VerticalAlignment="Stretch"
            Margin="5"
            telerik:StyleManager.Theme="Office_Blue"
            AutoGenerateColumns="False"
            ShowColumnFooters="True"
            ShowGroupFooters="True"
            RowIndicatorVisibility="Collapsed"
            ItemsSource="{Binding}">
            <telerik:RadGridView.GroupDescriptors>
                <telerik:GroupDescriptor Member="Period" SortDirection="Ascending" />
                <telerik:GroupDescriptor Member="Project" SortDirection="Ascending" />
            </telerik:RadGridView.GroupDescriptors>
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Project" UniqueName="Project" IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Rig Type" UniqueName="RigType" IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Period" UniqueName="Period" IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Requirement" UniqueName="RequiredRigYrs" IsReadOnly="True" CellTemplateSelector="{StaticResource gridViewTemplateSelector}" >
                    <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerik:SumFunction Caption="Requirement: " ResultFormatString="{} {0:0.00}" />
                    </telerik:GridViewDataColumn.AggregateFunctions>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Capability" UniqueName="AvailableRigYrs" IsReadOnly="False" DataFormatString="{} {0:0.00}">
                    <telerik:GridViewDataColumn.AggregateFunctions>
                        <telerik:SumFunction Caption="Capability: " ResultFormatString="{} {0:0.00}" />
                    </telerik:GridViewDataColumn.AggregateFunctions>
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</Window>

My problem is that it appears to be ignoring the style in Windows.Resources and displays the aggregated data in the group headers.

  
Raymond
Top achievements
Rank 1
 answered on 07 Nov 2013
4 answers
86 views
I have a RadPaneGroup and RadTreeview, I compare a RadTreeViewItem Header Header with the RadPane Header and close the RadPane when RadTreeViewItem is selected. How do I?

TreeView
<telerik:RadTreeView  x:Name="tvConfiguracao" IsOptionElementsEnabled="True" Checked="tvConfiguracao_Checked"
      <telerik:RadTreeViewItem x:Name="tviVenda" Header="VENDA" />
      <telerik:RadTreeViewItem x:Name="tviCompra"  Header="COMPRA />               
</telerik:RadTreeView>
Panels
<telerik:RadDocking x:Name="rdPrincipal"                             
            <telerik:RadSplitContainer InitialPosition="DockedBottom">
                <telerik:RadPaneGroup x:Name="rpgFiltros"
                    <telerik:RadPane x:Name="RadPaneCompra" Header="COMPRA"> </telerik:RadPane>
                    <telerik:RadPane x:Name="RadPaneVenda" Header="Venda"> </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
</telerik:RadDocking>
Event
private void tvConfiguracao_Checked(object sender, Telerik.Windows.RadRoutedEventArgs e)
       {
           var item = rdPrincipal.Panes.FirstOrDefault(i => i.Header == e.Source.Cast<RadTreeViewItem>().Header);
  
           if (item != null)
               item.Cast<RadPane>().IsHidden = true;
       }
Finds no Pane Even with Header, what is wrong?
LRScudeletti
Top achievements
Rank 1
 answered on 07 Nov 2013
2 answers
301 views
Hi, 

I am following some examples to bind a CartesianChart to a Datatable but I haven't been able to do it, this is my code:

<telerik:RadCartesianChart Name="chartTest" Margin="10" Palette="Grayscale">
    <telerik:RadCartesianChart.Behaviors>
        <telerik:ChartPanAndZoomBehavior PanMode="Both" ZoomMode="Both"/>
    </telerik:RadCartesianChart.Behaviors>
</telerik:RadCartesianChart>

And the code behind:

public class Chemistry
    {
        public string DESCRIPTION { get; set; }
        public double HEATS_IN_PCT { get; set; }
        public double HEATS_IN_PCT_LINE { get; set; }       
    }

public class MainViewModel
{
    public ObservableCollection<Chemistry> Data { get; private set; }
             
    public MainViewModel()
    {
        this.Data = GetTestData();
    }
 
    private static ObservableCollection<Chemistry> GetTestData()
    {
        var result = new ObservableCollection<Chemistry>();
 
        //Custom function to load a stored procedure data
        DataTable dtChemistry = DataRetriever.ExecuteRetrieveProcedure("SB_QUALITY_CHEMISTRY");
 
        foreach (DataRow dr in dtChemistry.Rows)
        {
            result.Add(new Chemistry
            {
                DESCRIPTION = dr["DESCRIPTION"].ToString(),
                HEATS_IN_PCT = (double)dr["HEATS_IN_PCT"],
                HEATS_IN_PCT_LINE = (double)dr["HEATS_IN_PCT_LINE"]
            });
        }
 
        return result;
    }
}

void Configure_Chart()
        {
            BarSeries barSer = new BarSeries() { Name = "barCrew" };
            barSer.ShowLabels = true;
            barSer.CombineMode = ChartSeriesCombineMode.Cluster;
 
            barSer.LabelDefinitions.Clear();
            barSer.LabelDefinitions.Add(new ChartSeriesLabelDefinition() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center });
 
            Telerik.Windows.Controls.ChartView.LineSeries lineSer = new Telerik.Windows.Controls.ChartView.LineSeries() { Name = "lineCrew" };
             
            barSer.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "DESCRIPTION" };
            barSer.ValueBinding = new GenericDataPointBinding<Chemistry, double>() { ValueSelector = Chemistry => Chemistry.HEATS_IN_PCT};
//Also used PropertyNameDataPointBinding("HEATS_IN_PCT");
 
            lineSer.CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "DESCRIPTION" };
            lineSer.ValueBinding = new GenericDataPointBinding<Chemistry, double>() { ValueSelector = Chemistry => Chemistry.HEATS_IN_PCT_LINE };
//Also used PropertyNameDataPointBinding("HEATS_IN_PCT_LINE");
 
            MainViewModel vm = new MainViewModel();
 
            barSer.ItemsSource = vm.Data;
            lineSer.ItemsSource = vm.Data;
 
            chartTest.Series.Add(barSer);
            chartTest.Series.Add(lineSer);
        }

And when I run the application, the series do not appear.

I am missing something?

Thanks,

Alberto




Alberto
Top achievements
Rank 1
 answered on 07 Nov 2013
1 answer
102 views
Hello!

My radGridView is filled by numbers. I export it to excel.  All cells in this file has type 'Common'.
This cause some values look rounded. 
For example: real number is 113199997.01, but in excel it looks like '113199997'.

How can I force cell to be 'Numeric' type?






Yoan
Telerik team
 answered on 07 Nov 2013
2 answers
303 views
Hi,
is it possible to hide the property grid row header (the first column, the one with the selection arrow)?

Thank you very much!

Enrico
Nicola Tramarin
Top achievements
Rank 1
 answered on 07 Nov 2013
3 answers
221 views
Hi,

we are doing standard validation using WPF INotifyDataErrorInfo and IDataErrorInfo interfaces on row values.
The validation messages display correctly, however are always duplicated (see attached pic). 

The column definition looks like this:

<telerik:GridViewDataColumn Header="Version" DataMemberBinding="{Binding Version}" IsReadOnly="True"/>

Any idea why this could be happening?

Note that the INotifyDataErrorInfo GetErrors() is only returning one item for the column

Regards,
Stevo

 

 

 

 

 

Yoan
Telerik team
 answered on 07 Nov 2013
1 answer
243 views
Hello!

On my RadPropertyGrid (having AutoGeneratePropertyDefinitions="True") I need to be able to show a context menu having a Reset 
menu item that will set the default value for the specific property definition selected.

To make things more complicated I cannot even see a simple ContextMenu for the entire property grid:

I tried to add a context menu to the whole RadPropertyGrid

<telerik:RadPropertyGrid.ContextMenu >
     <ContextMenu x:Name="menu">
            <MenuItem Header="Reset" Command="...."></MenuItem>
     </ContextMenu>
</telerik:RadPropertyGrid.ContextMenu>

But I cannot see that at all because the property grid is contained in the SettingsPaneView of a RadDiagram and no matter where in make the right click inside the PropertyGrid - I get the diagram's context menu

I badly need help!
R

Yoan
Telerik team
 answered on 07 Nov 2013
2 answers
184 views
Hello everyone,

We are encountering a little issue with spellchecking function of the richtextbox.

Let me explain the context : we are using Framework 3.5 and the runtime version of the Telerik library is v2.0.50727 for WPF.
Why 3.5? Because we also use Sharepoint 2010 and we have an application working with MVVM design pattern.

So here is our problem : we have a wpf page that creates dynamicly a table (rows and columns are dynamics) with a RichtextBox and each cell. Each cell has the right text and works fine. But whenever we try to use the spellcheck, it doesn't work. We investigated and realised that even if the spellcheck would see the wrong words on the control, you can't change it from the Right click context menu. We then realised that when we open up the context spell checking window, it automatically select the content of the first richtextbox object we have on the page. So even if the text content is the right one, it tries to replace it from the first RichtextBox of the table. Same goes for the Copy and paste functions.

First, we are not using the Telerik rich textbox by itself, we have another control that herits from it :
<UserControl x:Class="Eca.Assyst.Client.Common.RichTextEditor"
             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" 
             BorderBrush="Transparent" 
             Background="Transparent" 
             x:Name="thisUserControl"
             d:DesignHeight="300" 
             d:DesignWidth="300">
    <Grid>
        <telerik:HtmlDataProvider x:Name="htmlDataProvider"
                                  RichTextBox="{Binding ElementName=richTextBox}" 
                                  Html="{Binding Path=HtmlValue, ElementName=thisUserControl, Mode=TwoWay}">
            <telerik:HtmlDataProvider.FormatProvider>
                <telerik:HtmlFormatProvider>
                    <telerik:HtmlFormatProvider.ExportSettings>
                        <telerik:HtmlExportSettings DocumentExportLevel="Fragment" 
                                                    ExportStyleMetadata="False" 
                                                    StyleRepositoryExportMode="DontExportStyles" 
                                                    StylesExportMode="Inline"
                                                    ExportFontStylesAsTags="True" />
                    </telerik:HtmlFormatProvider.ExportSettings>
                </telerik:HtmlFormatProvider>
            </telerik:HtmlDataProvider.FormatProvider>
        </telerik:HtmlDataProvider>
        <telerik:RadRichTextBox x:Name="richTextBox" 
                                DocumentInheritsDefaultStyleSettings="True" 
                                BorderBrush="Transparent" 
                                Background="Transparent" 
                                AcceptsTab="False" />
    </Grid>
</UserControl>

Here is the control that is used for our table :
<UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="DataTemplates.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <StackPanel Margin="0,2,0,0"
                d:DataContext="{StaticResource ResourceKey=FindingEntryEditorViewModelMock}">
        <ContentControl x:Name="DropDownContainer"
                        Visibility="{Binding Path=DisplayStatusDropDown, Converter={StaticResource BooleanToVisibilityConverter}}">
            <telerik:RadComboBox x:Name="StatusComboBox"
                                SelectedValuePath="Value"
                                telerik:StyleManager.Theme="Metro"
                                ItemsSource="{Binding StatusItems, Converter={StaticResource EnumToListConverter}}" 
                                SelectedValue="{Binding Path=Entry.Status}">
                <telerik:RadComboBox.ItemTemplate>
                    <DataTemplate>
                        <Label Content="{Binding Path=Text}" Foreground="{Binding Path=Color}"></Label>
                    </DataTemplate>
                </telerik:RadComboBox.ItemTemplate>
            </telerik:RadComboBox>
        </ContentControl>
  
        <Common:RichTextEditor HtmlValue="{Binding Path=Entry.Text, Mode=TwoWay}"
                               GotFocus="richTextBox_GotFocus" 
                               LostFocus="richTextBox_LostFocus"></Common:RichTextEditor>
  
        <my:ReferencesEditor x:Name="referencesEditor" References="{Binding Path=Entry, Converter={StaticResource ResourceKey=ReferenceContainerConverter}}" />
    </StackPanel>

Here is the GridView table we use :
<ScrollViewer HorizontalScrollBarVisibility="Auto"
                                      VerticalScrollBarVisibility="Auto">
                            <StackPanel Orientation="Vertical">
                                <telerik:RadGridView x:Name="gridView"
                                                     RowIndicatorVisibility="Collapsed"
                                                     SelectedItem="{Binding SelectedItem}"
                                                     CanUserReorderColumns="False"
                                                     GridLinesVisibility="Horizontal"
                                                     ShowGroupPanel="False"
                                                     BorderThickness="0"
                                                     AutoGenerateColumns="False"
                                                     CanUserSortColumns="False"
                                                     CanUserFreezeColumns="False"
                                                     ColumnWidth="*"
                                                     BeginningEdit="GridView_OnBeginningEdit"
                                                     ItemsSource="{Binding Path=Finding.Items.List}"
                                                     EnableRowVirtualization="False"
                                                     EnableColumnVirtualization="False"
                                                     telerik:StyleManager.Theme="Windows7">
                                    <telerik:RadGridView.SortDescriptors>
                                        <telerik:SortDescriptor Member="SortOrder" SortDirection="Ascending"/>
                                    </telerik:RadGridView.SortDescriptors>
                                    <telerik:RadGridView.Columns>
                                        <telerik:GridViewDataColumn IsReadOnly="True"
                                                                    DataMemberBinding="{Binding Path=Code}"
                                                                    CellStyle="{StaticResource ResourceKey=CustomCellStyle}"
                                                                    Header="Type"
                                                                    Width="Auto" />
                                        <!-- More columns are added here dynamically by the code behind this file -->
                                    </telerik:RadGridView.Columns>
                                </telerik:RadGridView>
  
                                <AuditProgrammeEditor:FindingErrorSpecificationControl x:Name="ErrorSpecification"
                                                                                       Visibility="{Binding Path=DataContext.ShowAmountsTable, ElementName=MainContainer, Converter={StaticResource ResourceKey=BooleanToVisibilityConverter}}"
                                                                                       DataContext="{Binding MasterErrorEntry}"
                                                                                       IsEnabled="{Binding Path=DataContext.ReadOnly, ElementName=gridView, Converter={StaticResource ResourceKey=BooleanToInvertedBooleanConverter}}"
                                                                                       Margin="0,0,0,5"/>
                            </StackPanel>
                        </ScrollViewer>

And last but not least, this how we get our DataTemplate for each column :
public DataTemplate GetTemplate(int columnIndex, bool isEnabled)
        {
            var templateXaml = Properties.Resources.FindingTableEntryTemplate;
            templateXaml = templateXaml.Replace("{EntryIndex}", columnIndex.ToString(CultureInfo.InvariantCulture));
            templateXaml = templateXaml.Replace("{IsEnabled}", isEnabled.ToString(CultureInfo.InvariantCulture));
            var stream = new MemoryStream(Encoding.Default.GetBytes(templateXaml));
            return (DataTemplate)XamlReader.Load(stream);
        }

Thanks in advance !
ASSYST2 - CGI
Top achievements
Rank 1
 answered on 07 Nov 2013
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
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?