Telerik Forums
UI for WPF Forum
10 answers
339 views
We want to allow user to drag and drop to show/hide columns from a column chooser listbox. I am following the example code in http://www.telerik.com/help/wpf/radgridview-how-to-show-hide-columns-outside-of-the-radgridview.html.  We want to allow user to be able to drag a column from the list box and drop it in the column header of the grid. So it will be easy for user to design their grid columns layout.  Is there an example to do that?
Martin Ivanov
Telerik team
 answered on 20 Oct 2017
1 answer
79 views

Hi,

i have a radgridview on my wpf app. This grids itemssouce is bound to a List of objects in my ViewModel (MVVM).

When i click on a Button a new element is added to the bound list. This creates a new Row in my DataGrid like expected.

Question:
i want to focus the last cell in the new row after the new row was added.

I already have the correct way of doing this (see snippet below) but i dont know WHEN i should execute this code. When the bound items are changed its too early to do this and i cant use events like "LayoutUpdated" because it triggers too often.

Is there any possibility to launch this code AFTER the GridViewRow was Added?

private void OnInitializedGridViewCommand(RadGridView obj)
        {
            obj.Items.CollectionChanged += (sender, e) =>
            {
                var grid = obj as RadGridView;
                var rows = obj.ChildrenOfType<GridViewRow>().ToList();
                if (rows.Count < 1) return;
                var cells = rows[rows.Count - 1].ChildrenOfType<GridViewCell>().ToList();
                var box = cells[cells.Count - 1].ChildrenOfType<RadComboBox>();
                box.First().Focus();
            };
        }
Vladimir Stoyanov
Telerik team
 answered on 19 Oct 2017
5 answers
133 views

Hi~

I want to show RadialMenu over TileViewItem.

TileViewItem hide RadialMenu.

Here is example code.

<Window x:Class="TileView.MainWindow"
                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:tileView="clr-namespace:Telerik.Windows.Controls.TileView;assembly=Telerik.Windows.Controls.Navigation"
                Title="MainWindow" Height="350" Width="525">

    <Window.Resources>
        <Style TargetType="telerik:RadTileView">
            <Setter Property="PreservePositionWhenMaximized" Value="True" />
            <Setter Property="telerik:TileViewPanel.IsVirtualized" Value="True" />
            <Setter Property="IsAutoScrollingEnabled" Value="True" />
            <Setter Property="TileStateChangeTrigger" Value="SingleClick" />
            <Setter Property="MinimizedColumnWidth" Value="180" />
            <Setter Property="MinimizedRowHeight" Value="155" />
            <Setter Property="RowHeight" Value="250" />
            <Setter Property="ColumnWidth" Value="250" />
            <Setter Property="ColumnsCount" Value="3" />
        </Style>
        <Style TargetType="telerik:RadTileViewItem">
            <Setter Property="Background" Value="#eaeaea" />
        </Style>
        <DataTemplate x:Key="sizeTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Item" />
                <TextBlock Text="{Binding}" />
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="contentTemplate">
            <StackPanel>
                <telerik:RadRadialMenu Panel.ZIndex="99999">
                    <telerik:RadRadialMenuItem Header="Item 1" />
                    <telerik:RadRadialMenuItem Header="Item 2" />
                    <telerik:RadRadialMenuItem Header="Item 3" />
                </telerik:RadRadialMenu>
            </StackPanel>
        </DataTemplate>
    </Window.Resources>
    
    <Grid>
       
        <telerik:RadTileView  ItemsSource="{Binding}" ItemTemplate="{StaticResource sizeTemplate}"
                              ContentTemplate="{StaticResource contentTemplate}"  />
    </Grid>
</Window>

You can see capture file "Actual.png"

I want to "Expect.png" screen.

How?

Russell
Top achievements
Rank 1
 answered on 19 Oct 2017
2 answers
236 views

I have a major issue with checkbox columns in the RadGridView for WPF.  I tried using both Green Theme and the Expression Dark.  I prefer the Green theme but here is my problem:

When the pointer is still in the focus of the cell right after clicking all is good.  The checkbox appears as white on green and is obviously checked.

When the pointer loses focus witht he checkbox cell, the checkbox appears as white on white.  NO GOOD!  How do I fix this?

When you put the focus on a new row, all looks fine as the checkbox appears White on Black.

I tried setting  EnableLostFocusSelectedState="False" on the Grid as I read in another similar post that this might fix the issue, but it does not.  

I really hope the answer is not to modify the default themes as the whole reason we bought this package was to make life easier.  Not more difficult.  It is totally illogical to show white on white for a default theme for a checkbox because it defeats the purpose of a checkbox.

Thank you...

 

 

 

 

Dinko | Tech Support Engineer
Telerik team
 answered on 19 Oct 2017
7 answers
363 views

I have created a custom data row and a custom data table class by extending both MyDataRow and MyDataTable classes. MyDataRow and MyDataTable are defined in my data set file (.xsd). I.e., I'm using a real database. MyDataTable has a few fields (Id, Status, DateCreated, etc...).

In XAML, I have set RadGridView control's ItemsSource property to a DataView object (bound to ViewModel's property). In short, new MyDataTable().DefaultView. Naturally it's been filled with data from the database before getting the DefaultView.

The reason why I created the custom classes was that I want to add additional property (IsReadOnly) to be used together with IsReadOnlyBinding and I don't want to change the database or the data set file structure.

This is how I have created the custom classes (the second answer): https://stackoverflow.com/questions/3101412/how-to-extend-datarow-and-datatable-in-c-sharp-with-additional-properties-and-me

When I set grid's IsReadOnlyBinding="{Binding IsReadOnly}", an exception is thrown when try to add a new row or edit an existing one. The exception says: Property with specified name: IsReadOnly cannot be found on component: System.Data.DataRowView

However, if I set IsReadOnlyBinding="{Binding Status}", it works. Status field already exist in my database table.

Is the grid using internally the data set schema (.xsd) or what might cause this? Any ideas how to solve this?

I am trying to accomplish functionality where rows cannot be edited until I click a modify button (which sets IsReadOnly to false for the selected row) but I still want to add new rows using the grid's new row button.

I wish I could attach actual code but there's a lot of it and it's not easy to copy-paste it here. I could try to put together a test project if my description is not clear enough.

Martin Ivanov
Telerik team
 answered on 18 Oct 2017
1 answer
209 views

I've been banging my head everywhere trying to figure out how to hide values bound to a GridViewComboBox column. 

I'm using ItemsSourceBinding to populate the dropdown with values and then matching up to default values from ItemsSource.  Basically some of the values that are prepopulated from another system like "Approved" or "New" I want to not make those options selectable when the user tries to edit the cell even though they can see them.  

<telerik:RadGridView VerticalAlignment="Stretch" Grid.Row="1" x:Name="PoliciesGridView" ItemsSource="{Binding Policies, Mode=TwoWay}" AutoGenerateColumns="False" DataLoaded="PoliciesGridView_DataLoaded" SelectionMode="Extended" ScrollViewer.VerticalScrollBarVisibility="Visible" CellEditEnded="CellEditEnded" GroupRenderMode="Flat" CanUserDeleteRows="False" Grouped="Grid_Grouped" KeyUp="HandleKeyUpEvent">
<telerik:EventToCommandBehavior.EventBindings>
<telerik:EventBinding Command="{Binding EditCommand}" EventName="BeginningEdit" PassEventArgsToCommand="True"/>
</telerik:EventToCommandBehavior.EventBindings>

<telerik:GridViewComboBoxColumn DataMemberBinding="{Binding CurrentStatus, Mode=TwoWay}" Tag="CurrentStatus" Header="Status" ItemsSourceBinding="{Binding PolicyStatusCodeTable}" DisplayMemberPath="PolicyStatusDsc" SelectedValueMemberPath="PolicyStatusDsc" CellStyleSelector="{StaticResource editedCellStyle }" TextAlignment="Right"/>

I have been successful in setting up an EditCommand to cancel the edit if the Status is Approved thereby making any rows that are Approved read-only as well as reverting the value back to the original value should they choose Approved.  It's a hack  but I feel like there should be a way to just hide those options from the gridviewcombobox so users can't select them.  

 

Dilyan Traykov
Telerik team
 answered on 18 Oct 2017
7 answers
117 views

So i have this model:

public class MachineNetworkAdapter
{
  public string Name { get; set; }
  public string IpAddress { get; set; }
  public static List<MachineNetworkAdapter> MachineAdapters;
}

 

So each mechine adapter have this members.
So i have this Combobox that show all my Machine Adapters:

<ComboBox
    Name="cbAdapterss"
    ItemsSource="{Binding MachineAdapters}"
    SelectionChanged="cbInterfaces_SelectionChanged"/>

 

So in this case i can see all my machine adapters with this properties.
Now i want to see also my adapters Rate in MBit/sec so i added this members:

public Series { get; set; }
  public double Rate { get; set; }

 

the member Rate is MBit/sec and the value is changing every 1 sec. the series is for the chart in order to put into the values.
So i added template with chartand now this is my Combobox:

<ComboBox
    Name="cbAdapters"
    ItemsSource="{Binding MachineAdapters}"
    SelectionChanged="cbInterfaces_SelectionChanged">
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <telerik:RadCartesianChart
                x:Name="chartTemplate"/>
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>

 

So now all i can see in my Combobox is an empty chart without the other properties. So my question is how can i populate my chart and also see the other properties (Name, IPAddress).

Martin Ivanov
Telerik team
 answered on 18 Oct 2017
2 answers
110 views

Hello,

I have some slides in my Sort View with a drag and drop functionality. When I wanted to drag and drop the slides its working fine, but when I was trying to move the 'last slide" it's showing that drag after the "last slide".

Please give me an idea to get rid of that text for only last slide. It has to show up to last but one slides but I don't want this for last slide, it's only happening when Im having the scrollbar at the bottom. Here I'm attaching the screenshots of the issue please go through them, and if you can give me suggestion that would be great for me.

 

Thank you,

Naga.

Dinko | Tech Support Engineer
Telerik team
 answered on 18 Oct 2017
5 answers
216 views

I identified performance loss while using Alternating rows.

Based on already existing posts: http://www.telerik.com/forums/alternating-rows-hurts-performance

I implemented my own RowStyle selector:

    public class RadGridViewAlternatingRowTemplateSelector : StyleSelector
    {
        private static int counter = int.MinValue;

        public override Style SelectStyle(object item, DependencyObject container)
        {
            return (counter++ % 2) == 0 ? EvenRowStyle : OddRowStyle;
        }

        public Style EvenRowStyle { get; set; }
        public Style OddRowStyle { get; set; }
    }

I tried to keep it as short and simple as possible for a maximum performance.

    <template:RadGridViewAlternatingRowTemplateSelector x:Key="AlternativeRowStyleSelector">
        <template:RadGridViewAlternatingRowTemplateSelector.EvenRowStyle>
            <Style TargetType="telerik:GridViewRow" BasedOn="{StaticResource GridViewRowStyle}">
                <Setter Property="Background" Value="{DynamicResource RowBackgroundColor}"/>
            </Style>
        </template:RadGridViewAlternatingRowTemplateSelector.EvenRowStyle>
        <template:RadGridViewAlternatingRowTemplateSelector.OddRowStyle>
            <Style TargetType="telerik:GridViewRow" BasedOn="{StaticResource GridViewRowStyle}">
                <Setter Property="Background" Value="{DynamicResource SecondRowBackgroundColor}"/>
            </Style>
        </template:RadGridViewAlternatingRowTemplateSelector.OddRowStyle>
    </template:RadGridViewAlternatingRowTemplateSelector>

 

 <Style TargetType="{x:Type telerik:RadGridView}" BasedOn="{StaticResource RadGridViewStyle}">
        <Setter Property="RowStyleSelector" Value="{StaticResource AlternativeRowStyleSelector}" />
        <Setter Property="GridLinesVisibility" Value="Vertical" />
        <Setter Property="ValidatesOnDataErrors" Value="InEditMode" />
        <Setter Property="AutoGenerateColumns" Value="False" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="IsReadOnly" Value="True" />
        <Setter Property="ShowGroupPanel" Value="False" />
        <!--<Setter Property="ShowColumnSortIndexes" Value="False" />-->
         <!--This is not possible, because no DP!--> 
        <Setter Property="RowIndicatorVisibility" Value="Collapsed" />
        <Setter Property="IsFilteringAllowed" Value="False" />
        <Setter Property="CanUserSortColumns" Value="False" />
        <Setter Property="CanUserSortGroups" Value="False" />
        <Setter Property="CanUserReorderColumns" Value="False" />
        <Setter Property="CanUserResizeColumns" Value="False" />
        <Setter Property="CanUserResizeRows" Value="False" />
        <Setter Property="CanUserFreezeColumns" Value="False" />
        <Setter Property="FontSize" Value="{DynamicResource FontSize}" />
        <Setter Property="FontFamily" Value="{DynamicResource FontFamily}" />
        <Setter Property="EnableColumnVirtualization" Value="False" />
        <Setter Property="EnableRowVirtualization" Value="True" />
        <Setter Property="GroupRenderMode" Value="Flat" />
    </Style>

In addition, I tried using NoXAML assemblies (as you can see at my style definition) to even squeeze more performance out of Telerik controls.
Summary: NoXAML Assemblies, Own Style Selector, GroupRenderMode Flat, other properties in Style, RadGridView in * Grid Row,...
There isn't any single point left I could optimize (refering to this article: http://docs.telerik.com/devtools/wpf/controls/radgridview/troubleshooting/performance)

The performance is pretty damn nice if I use no alternating rows.
But when I use them (and I definitely have to, with or without Telerik) the performance drops to an unacceptable point.

So my question here is: Is there anything I can do to speed things up? Are there any updates on alternating row performance?

Thanks in advance

 

Ivan Ivanov
Telerik team
 answered on 18 Oct 2017
1 answer
130 views

Is there a way to create a maskeditfield when using AutoGeneratingField on a DataForm?  

I see one example of switching to a new field type in your documentation:

e.DataField = new DataFormNumericUpDownField() { Label = e.DataField.Label, DataMemberBinding = e.DataField.DataMemberBinding };

However DataFormNumericUpDownField does not seem to exist not to mention it does not sound like the type of field I am looking for.

Is there a way to switch to a Mask Edit control in the AutoGeneratingField event?

If so, can you show an example of this?

Thanks...

 

 

Vladimir Stoyanov
Telerik team
 answered on 17 Oct 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?