Telerik Forums
UI for WPF Forum
11 answers
527 views
How do I set the default, initial view for a PropertyGrid to display categorized/grouped instead of listed Alphabetically?

There is a property (SortAndGroupVisibility) for enabling the option to change this by the end user, but I see no means to directly set this in Xaml or code behind...


Pavel
Top achievements
Rank 1
 answered on 09 Feb 2012
3 answers
218 views
I've been tracking down a performance problem, and I have it trimmed down to a sample application.  For code I am using, see below.

Edit: This also repros in the "RadControls for WPF Q3 2011 SP1 Demos" package, using the "Scrolling 1 Billion Cells" example.

A) Scroll to the bottom of the RadGridView, so that the bottom-most row is in-view.
B) Attempt to resize the window.

At this point my entire OS hangs.  I am able to regain control of the OS by CTRL-ALT-DEL then cancelling.  At this point I can break the debugger and determine the code is within GridViewCellsPanel.MeasureCell (bottom of stack is GridViewDataControl.MeasureOverride).

I suspect the RadGridView is de-virtualizing when this happens, as the performance gets worse with more records.  While this is happening, I can watch in Task Manager that the CPU usage is pegging and the memory usage goes from about 50MB to about 600MB.

Any suggestions?  This will be a blocker since we do not experience this behavior in WPF's native DataGrid.

Thanks -
- Graeme

XAML:
<telerik:RadGridView ItemsSource="{Binding}" />

Sample class used:
public class Junk
{
    public int Prop0 { get; set; }
    public int Prop1 { get; set; }
    public int Prop2 { get; set; }
    public int Prop3 { get; set; }
    public int Prop4 { get; set; }
    public int Prop5 { get; set; }
    public int Prop6 { get; set; }
    public int Prop7 { get; set; }
    public int Prop8 { get; set; }
    public int Prop9 { get; set; }
    public int Prop10 { get; set; }
    public int Prop11 { get; set; }
}

Loaded Event Handler:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
    Random random = new Random();
    List<Junk> list = new List<Junk>();
    for (int index = 0; index < 50000; ++index)
    {
        list.Add(new Junk()
        {
            Prop0 = random.Next(),
            Prop1 = random.Next(),
            Prop2 = random.Next(),
            Prop3 = random.Next(),
            Prop4 = random.Next(),
            Prop5 = random.Next(),
            Prop6 = random.Next(),
            Prop7 = random.Next(),
            Prop8 = random.Next(),
            Prop9 = random.Next(),
            Prop10 = random.Next(),
            Prop11 = random.Next(),
        });
    }
    DataContext = list;
}
Vlad
Telerik team
 answered on 09 Feb 2012
1 answer
223 views
As title says, is it possible to scroll the scheduleview horizontally and/or vertically from code-behind in WPF?

As you can probably appreciate the scrollbars provided by the scheduleview are a little too small for a touchscreen application I'm working on so I'd like the user to be able to navigate around a scheduleview some other way.

EDIT: I should note that it's important for the user to be able to scroll despite the fact that I'm using resources for grouping. Basically - to provide the functionality the scrollbars do at the moment.
Daniel
Top achievements
Rank 1
 answered on 09 Feb 2012
1 answer
115 views
Hello telerik,
I've got a Master Detail GridView that on the expand button shows the child element using a behaviour,
I wish when I click the export button to export all the columns the grid

My object is of this kind

public class DummyObj

  {

      public int ID { get; set; }

      public int Col1 { get; set; }

      public int Col2 { get; set; }

      public int Col3 { get; set; }

      public int Col4 { get; set; }

      public int Col5 { get; set; }

 

  }

  The master has ID and Col1 and the Hierarchical Col2,3,4,5 ... the viewmodel binds the whole item to the master,  when I export (for now) I got ID Col1... How can I access by codebehind to the HierarchicalChildDataTemplate and enumerate througth the columns?

Thanks
Dimitrina
Telerik team
 answered on 09 Feb 2012
4 answers
111 views
Is it possible to show a Tooltip for a data series only on the plotted points and not on the slope? I do not want the "closest" point's tooltip to be shown when the mouse hovers on the slope.
Evgenia
Telerik team
 answered on 09 Feb 2012
1 answer
162 views
I'm trying to replicate a "feature" of the Infragistics XamDataGrid so I can do a performance comparison between the two. 

When I open a window with an empty Infragistics grid, the grid shows up with the window, but the grid content (headers, etc.) show up later (i.e., loaded asynchronously). Is it possible to do the same with the Telerik grid? 
Vlad
Telerik team
 answered on 09 Feb 2012
5 answers
195 views
I downloaded a project from Telerik named WPFBindingNavigator to get bindingnavigator into my WPF project.  The downloaded project works when run, but the designer throws an "object reference not set to an instance of the object" error.  I am trying to replicate the functionality within my WPF application but cannot seem to get past this error during design time.

Following is a snippet of the error in the "Presentation" project (which references the WPFBindingNavigator, which is a class library):
 
xmlns:bn="clr-namespace:BindingNavigator;assembly=BindingNavigator"
The next code block raises the error mentioned above:
<bn:BindingNavigator Grid.Row="0" Margin="2" 
Background="Wheat"
x:Name="navigator"
ItemsSource="{Binding People}"
AddNewItemCommand="{Binding AddNewPersonCommand}"
DeleteItemCommand="{Binding DeletePersonCommand}"
SaveCommand="{Binding SaveCommand}"
/>

Any help will be appreciated.  Also, if there is a better way of creating the BindingNavigation functionality within WPF, please let me know.

Thanks in advance.
Ladislav
Top achievements
Rank 1
 answered on 08 Feb 2012
2 answers
161 views
 <SolidColorBrush x:Key="LegendBorderBrush"  Color="White" />
        <Thickness x:Key="LegendBorderThickness">0</Thickness>
        <Style x:Key="CustomLegendItemStyle" TargetType="telerik:ChartLegendItem">
            <Setter Property="BorderBrush"
            Value="{StaticResource LegendBorderBrush}" />
            <Setter Property="BorderThickness"
            Value="{StaticResource LegendBorderThickness}" />


            <Setter Property="Template" >
                <Setter.Value>
                    <ControlTemplate TargetType="telerik:ChartLegendItem" >
                        <Border BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}">
                            <Grid x:Name="PART_MainContainer" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0,0,5,0"  >


                                <Path x:Name="PART_LegendItemMarker"                                 
                                  Height="20"
                                  Width="80"
                                  Style="{TemplateBinding ItemStyle}"
                                  Stretch="Fill"
                                  >
                                    <Path.Data>
                                        <PathGeometry x:Name="PART_ItemMarkerGeometry" />
                                    </Path.Data>
                                </Path>


                                <CheckBox IsChecked="True"
                                      VerticalAlignment="Center"
                                      Margin="2,0"
                                      Content="{TemplateBinding Label}"
                                      Foreground="{TemplateBinding Foreground}"                                      
                                      BorderThickness="0"
                                      Checked="CheckBox_Checked" Unchecked="CheckBox_Checked"   />


                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

Above code used to set the radchart legend items. I do not need to display border color for legend items. Setting white,transparant or borderthickness 0 is not helping. Please throw some light. Thanks.
Bhakti
Top achievements
Rank 1
 answered on 08 Feb 2012
2 answers
357 views
Hello!

I follow the documentation and i manage to use the GridView ComboBox Column perfectly. The one issue is, I have to click three times
in order to change its value.

Since i already worked with CheckBoxColumn i follow that approach:
http://www.telerik.com/help/wpf/gridview-checkbox-column-clicks.html

I Set the "EditTriggers" property of the ComboBoxColumn to CellClick but I still need to click two times. The ComboBox Column doesn't have the AutoSelectOnEdit="True" as the CheckBoxColumn has. I realy like the ComboBoxColumn, is there a way to workaround this without creating a DataTemplate  with a Combobox?

Thank you.
       



RadControls for Wpf
Number of clicks in the CheckBox column
Send Feedback

PROBLEM

If you have a GridViewCheckBox column to your gridview you need to click three times by default in order to change the value of the checkbox - the first two clicks will enter the edit mode and the last one will change the value.

The following solutions will give you options to control the number of clicks needed to change the value of the checkbox column.

SOLUTION

Collapse image First approach

2 clicks solution

By setting the EditTriggers="CellClick" property of the GridViewCheckBoxColumn the cells will enter edit mode with a single click only. Now you will need one more click to change the value of the checkbox.

1 clicks solution

In addition to the EditTriggers="CellClick" property, you can set the AutoSelectOnEdit="True" property of the GridViewCheckBox column. This property will alter the checked state of the checkbox as soon as the cell enters edit mode, thus changing the value on a single click. Please note that the GridView has to be focused.

This could be done in XAML or in code behind when the columns are AutoGenerated:

CopyXAML
<telerik:GridViewCheckBoxColumn Name="CheckBoxColumn"
            EditTriggers="CellClick"
            AutoSelectOnEdit="True"
            DataMemberBinding="{Binding IsChampion}" />

CopyC#
private void gridView_AutoGeneratingColumn(object sender, GridViewAutoGeneratingColumnEventArgs e)
{
    var dataColumn = e.Column as GridViewDataColumn;

    if (dataColumn != null)
    {
        if (dataColumn.UniqueName.ToString() == "IsChampion")
        {
            // create GridViewCheckBoxColumn
            GridViewCheckBoxColumn newColumn = new GridViewCheckBoxColumn();
            newColumn.DataMemberBinding = dataColumn.DataMemberBinding;
            newColumn.Header = dataColumn.Header;
            newColumn.UniqueName = dataColumn.UniqueName;
            newColumn.EditTriggers = Telerik.Windows.Controls.GridView.GridViewEditTriggers.CellClick;
            newColumn.AutoSelectOnEdit = true;
            e.Column = newColumn;
        }
    }
}
CopyVB.NET
Private Sub gridView_AutoGeneratingColumn(sender As Object, e As GridViewAutoGeneratingColumnEventArgs)
    Dim dataColumn = TryCast(e.Column, GridViewDataColumn)
    If dataColumn IsNot Nothing Then
        If dataColumn.UniqueName.ToString() = "IsChampion" Then
            ' create GridViewCheckBoxColumn
            Dim newColumn As New GridViewCheckBoxColumn()
            newColumn.DataMemberBinding = dataColumn.DataMemberBinding
            newColumn.Header = dataColumn.Header
            newColumn.UniqueName = dataColumn.UniqueName
            newColumn.EditTriggers = Telerik.Windows.Controls.GridView.GridViewEditTriggers.CellClick
            newColumn.AutoSelectOnEdit = True
            e.Column = newColumn
        End If
    End If
End Sub

Collapse image Second approach

Another approach you can use is to leverage the CellTemplate of the GridViewDataColumn and put a checkbox in it:

CopyXAML
<telerik:GridViewDataColumn DataMemberBinding="{Binding IsActive}" 
                            IsReadOnly="True">
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <CheckBox IsChecked="{Binding IsActive, Mode=TwoWay}"
                      telerik:StyleManager.Theme="Office_Black"/>
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>

The checkbox is two-way bound to the IsActive bool property so with single click you change it. The benefit here is that the checkbox looks enabled, because it is in the CellTemplate while in the first approach the checkbox looks disabled (because the cells are not in edit mode yet). Note that the column is read-only, since this is a checkbox with two-way binding and there is no need to enter the edit mode at all.

Missing User
 answered on 08 Feb 2012
1 answer
317 views
Hi,

We are using DevExpress wpf datagrid in our projects but we came into conflict on a very critical issue. We are creating our columns dynamically in a way compliant to MVVM pattern in our project. The column headers of columns created dynamically contains date information(year and week of year) as it can be seen in unbanded.png attached. but we want the column headers to be banded according to year month week  hierarchy as it is explained in banded.png attached. I have also attached the sample code that creates the columns.

This is a very critical issue for us because most of our project's  functionality comes from Grid. If Telerik grid can give us this flexibility we will be giving back our license to DevExpress and buy Telerik licenses for developers. We are on a very critical time schedule any solid proof (based on sample) that this can be done by telerik component will lead us to change our component source. Urgent response will be appreciated.

Thanks

XAML

<Window x:Class="DynamicColumnSample.MainWindow"
        xmlns:local="clr-namespace:DynamicColumnSample"
        xmlns:my="clr-namespace:DynamicColumnSample.Objects"
        xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" Title="MainWindow"
        xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:DynamicColumnSanple="clr-namespace:DynamicColumnSample"
        Width="525"
        Height="364">
    <Window.DataContext>
        <local:ViewModel />
    </Window.DataContext>
    <Window.Resources>
        <my:ColumnTemplateSelector x:Key="ColumnTemplateSelector" />
        <DataTemplate x:Key="DefaultColumnTemplate">
            <ContentControl>
                <dxg:GridColumn AllowEditing="False"
                                    my:ColumnBindingHelper.BindingPath="{Binding FieldName}"
                                    Header="{Binding Header}" />
            </ContentControl>
        </DataTemplate>
        <DataTemplate x:Key="TextColumnTemplate">
            <ContentControl>
                <dxg:GridColumn AllowEditing="True"
                                    my:ColumnBindingHelper.BindingPath="{Binding FieldName}"
                                Header="{Binding Header}"
                                   >
                  
                    <dxg:GridColumn.EditSettings>
                        <dxe:TextEditSettings Tag="{Binding Path=Tag}" ToolTip="{Binding Path=ToolTip}" />
                    </dxg:GridColumn.EditSettings>
                </dxg:GridColumn>
            </ContentControl>
        </DataTemplate>
 
    </Window.Resources>
    <Grid>
        <dx:PopupBase Name="hitInfoPopup" Placement="Mouse" PlacementTarget="{Binding ElementName=treeListStoreUnitSchedule}" Opened="hitInfoPopup_Opened">
            <Grid Width="250" Height="250" Background="Beige">
                <Border Padding="12,8,24,10">
                    <ItemsControl Name="hitIfoItemsControl">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal" >
                                    <TextBlock Text="{Binding Name}"></TextBlock>
                                    <TextBlock Text="{Binding Text}"></TextBlock>
                                </StackPanel>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </Border>
            </Grid>
        </dx:PopupBase>
        <dxg:GridControl x:Name="treeListStoreUnitSchedule"
                             
                             Grid.Row="1"
                             ColumnGeneratorTemplateSelector="{StaticResource ColumnTemplateSelector}"
                             ColumnsSource="{Binding GridColumns}"
                             ItemsSource="{Binding RegionObjects}">
            <dxg:GridControl.Resources>
                <my:CustomChildrenSelector x:Key="childrenSelector" />
            </dxg:GridControl.Resources>
            <dxg:GridControl.View>
 
                <dxg:TreeListView x:Name="view"
                                  ChildNodesSelector="{StaticResource childrenSelector}"
                                  TreeDerivationMode="ChildNodesSelector"
                                  local:TreeListExpandedNodesHelper.SynchIsExpanded="True"
                                  >
                    
                    <dxg:TreeListView.RowCellMenuCustomizations>
                        <dxb:BarCheckItem Name="checkItem1" Content="Checked" IsChecked="True" dxb:BarItemLinkActionBase.ItemLinkIndex="0" />
                        <dxb:BarItemLinkSeparator dxb:BarItemLinkActionBase.ItemLinkIndex="1" />
                    </dxg:TreeListView.RowCellMenuCustomizations>
 
                    <dxg:TreeListView.CellTemplate>
                        <DataTemplate>
                            <Border
BorderBrush="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dxg:GridCellContentPresenter}}, Path=BorderBrush}"
BorderThickness="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dxg:GridCellContentPresenter}}, Path=BorderThickness}">
                                <dxe:TextEdit x:Name="PART_Editor"/>
                            </Border>
                        </DataTemplate>
                    </dxg:TreeListView.CellTemplate>
 
                </dxg:TreeListView>
            </dxg:GridControl.View>
        </dxg:GridControl>
        <Button  Command="{Binding Path=AddCommand}" Content="Button" Height="23" HorizontalAlignment="Left" Margin="321,0,0,0" Name="button1" VerticalAlignment="Top" Width="75" />
    </Grid>
</Window>


ViewModel

private void PopulateMonthList() {
           try {
               ObservableCollection<MonthInfo> tmpMonthInfo = new ObservableCollection<MonthInfo>(){
                                                           new MonthInfo(){MonthName="2011-01", MonthNumber=201101},
                                                           new MonthInfo(){MonthName="2011-02", MonthNumber=201102},
                                                           new MonthInfo(){MonthName="2011-03", MonthNumber=201103},
                                                           new MonthInfo(){MonthName="2011-04", MonthNumber=201104},
                                                           new MonthInfo(){MonthName="2011-05", MonthNumber=201105},
                                                           new MonthInfo(){MonthName="2011-06", MonthNumber=201106},
                                                           new MonthInfo(){MonthName="2011-07", MonthNumber=201107},
                                                           new MonthInfo(){MonthName="2011-08", MonthNumber=201108},
                                                           new MonthInfo(){MonthName="2011-09", MonthNumber=201109},
                                                           new MonthInfo(){MonthName="2011-10", MonthNumber=201110},
                                                           new MonthInfo(){MonthName="2011-11", MonthNumber=201111},
                                                           new MonthInfo(){MonthName="2011-12", MonthNumber=201112},
                                                           new MonthInfo(){MonthName="2012-01", MonthNumber=201201},
                                                           };
               TextColumn txtColumn = null;
 
               for (int i = 0; i < 13; i++) {
 
                   txtColumn = new TextColumn();
                   txtColumn.FieldName = "SalesInfoObject[" + i.ToString() + "].Quantity";
                   txtColumn.Header = tmpMonthInfo[i].MonthName.ToString();
                   txtColumn.Setting = SettingsType.Text;
                   txtColumn.Tag = "SalesInfoObject[" + i.ToString() + "]";
                   txtColumn.ToolTip = "SalesInfoObject[" + i.ToString() + "]" + "].Brand";
                   _gridColumns.Add(txtColumn);
               }
 
               _gridColumns.Insert(0, new GridColumn() { Header = "Store Region", FieldName = "Name", Setting = SettingsType.Default });
               _gridColumns.Insert(1, new GridColumn() { Header = "Store Quantity", FieldName = "Count", Setting = SettingsType.Default });
               OnPropertyChanged("GridColumns");
 
           } catch (Exception ex) {
 
               throw ex;
           }


Vlad
Telerik team
 answered on 08 Feb 2012
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
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
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
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?