Telerik Forums
UI for WPF Forum
1 answer
119 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
113 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
167 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
202 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
167 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
364 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
323 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
1 answer
127 views
Hello Telerik team,

I am trying to bind my RowHeight property on the RadTreeListView to the FontSize. 

The reason I am doing this is that the user can change the FontSize at the application level using a setting on the menu and setting the RowHeight=20 (lets say) works for small fonts, but as the user increases the FontSize, the RowHeight hard set to 20 does not work well anymore as the content overflows

Any ideas on how to adjust the RowHeight property based on the FontSize property?

Thanks,
Kumar
Nick
Telerik team
 answered on 08 Feb 2012
3 answers
102 views
Hello,
I'm using Entity Framework to provide data to the treeview and I have a tree like this:
<CollectionViewSource x:Key="categoriesViewSource" d:DesignSource="{d:DesignInstance Model:Category, CreateList=True}" />

Assigning DataContext and so on, so everything works fine and correctly displays hierarchical data.

<telerik:RadTreeView HorizontalAlignment="Stretch" IsEditable="True" 
                                     ItemsSource="{Binding}" 
                                     Name="CategoryTreeView" 
                                     VerticalAlignment="Stretch" 
                                         SelectionChanged="CategoryTreeView_OnSelectionChanged" 
                                         KeyUp="CategoryTreeView_KeyUp"
                                         Edited="CategoryTreeView_Edited">
                        <telerik:RadTreeView.ItemEditTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding Name, Mode=TwoWay}"/>
                            </DataTemplate>
                        </telerik:RadTreeView.ItemEditTemplate>
                        <telerik:RadTreeView.ItemTemplate>
                            <HierarchicalDataTemplate ItemsSource="{Binding Subcategories}">
                                <TextBlock Text="{Binding Name}" />
                            </HierarchicalDataTemplate>
                        </telerik:RadTreeView.ItemTemplate>
                    </telerik:RadTreeView>

And I want to add root category programmatically. This is what I do:
Category parent = CategoryTreeView.SelectedItem == null 
                    ? null 
                    : _context.Categories.FirstOrDefault(
                            c => c.CategoryID == ((Category) CategoryTreeView.SelectedItem).CategoryID);
           
            Category newCategory = new Category
                                       {
                                           Name = "New category",
                                           ParentCategory = parent,
                                           ParentID = parent == null ? (Guid?) null : parent.CategoryID
                                       };
            _context.Categories.AddObject(newCategory);
Everything also works fine and child items are inserting to selected node. Works until I try to add a root node. When no selected item is available, this code won't work. New category adds to collection but never displays on tree. Can you please help me?
Thank you.
Petar Mladenov
Telerik team
 answered on 08 Feb 2012
2 answers
266 views
Hi,
  I need to create GridView with Header & other rows with rounded corners with shadow effect to it & also its should be flexible for all resolution. Please find the attached image for the requirement.

Thank U
Selva
Selva M
Top achievements
Rank 2
 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
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?