Telerik Forums
UI for WPF Forum
4 answers
200 views
Hi,

I am trying to use RowStyleSelector with a RadGridView having an ItemsSource of type ObservableCollection<T>. The RowStyleSelector looks at the value of a property of T to set the background color of the corresponding row.

My problem is that the items may be altered outside of the grid. The new values are immediately picked up by the cells of the grid (because of the ObservableCollection and because T implements INotifyPropertyChanged), but the row style is not updated accordingly. However, if I sort the grid by clicking on one of the columns, the row styles are updated.

How can I ensure that the style is updated as soon as the values of the cells are updated?

In case it matters, this is how the RadGridView is declared (stripped down a bit):
<telerik:RadGridView Name="DocumentGrid" SelectionMode="Extended" ItemsSource="{Binding Path=Documents}" AutoGenerateColumns="False" IsReadOnly="True" RowStyleSelector="{StaticResource DocumentStyleSelector}">

This is the RowStyleSelector (stripped down a bit):
internal class DocumentStyleSelector : StyleSelector
{
    public Style DocumentModifiedStyle { get; set; }
 
    public override Style SelectStyle(object item, DependencyObject container)
    {
        var document = item as Document;
        if (document != null && document.EntityState == EntityState.Modified)
        {
            return DocumentModifiedStyle;
        }
        return null;
    }
}

And this is the Style (stripped down a b
<layout:DocumentStyleSelector x:Key="DocumentStyleSelector">
    <layout:DocumentStyleSelector.DocumentModifiedStyle>
        <Style TargetType="telerik:GridViewRow">
            <Setter Property="Background" Value="DarkGray" />
        </Style>
    </layout:DocumentStyleSelector.DocumentModifiedStyle>
</layout:DocumentStyleSelector>


Best regards
Linus
Dimitrina
Telerik team
 answered on 06 Mar 2015
3 answers
335 views
Hi I see there are 3 sizes for tiles at the moment. Single, Double and quadruple.

I was wondering if there are anymore sizes. I would like a Double and a Quadruple to be Stack ontop of eachother vertically. 
Maya
Telerik team
 answered on 06 Mar 2015
2 answers
89 views
Hi Team,

The RadGridView performs very poorly when you sort by a column with non unique values and select many rows. The UI thread gets stuck and it takes a while for it to come back, which causes issues with updates or other user operations following it. Our test was done on 50,000 rows.

To reproduce:
1. Bind RadGridView ItemsSource to a collection with 50,000 items. Set selection mode to Extended.  Make one values of one property unique and the other constant.
2. Run the sample and sort by the column with constant value.
3. Select all rows in the grid (CTRL+A)
4. Click on any row on the grid to verify that Dispatcher thread is locked. 
Note that if grid is sorted by unique value column same operation is fairly fast.

See below for the sample view, code behind and VM to reproduce this issue.
<Window x:Class="VariousDataSources.MainWindow"
        Title="MainWindow" >
    <Window.Resources>
    </Window.Resources>
        <telerik:RadGridView x:Name="RadGridView1" GroupRenderMode="Flat" AutoGenerateColumns="True"
                             RowIndicatorVisibility="Collapsed" CanUserFreezeColumns="False"
                             ItemsSource="{Binding DataSource}" SelectionMode="Extended">
        </telerik:RadGridView>
</Window>
 
 
   public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DataContext = new MyModel();
        }
    }

public class MyRow
  {
      public int SlowColumn { get; set; }
      public int FastColumn { get; set; }
  }
 
  public class MyModel : ViewModelBase
  {
      public MyModel()
      {
 
          DataSource = new ObservableCollection<MyRow>();
          for (var i = 0; i < 50000; i++)
          {
              var row = new MyRow();
              row.SlowColumn = 1;
              row.FastColumn = i;
              DataSource.Add(row);
          }
      }
 
      public ObservableCollection<MyRow> DataSource { get; set; }
  }
Maya
Telerik team
 answered on 05 Mar 2015
1 answer
168 views
Good Morning.

I need to put a RadAutoCompleteBox inside a GridViewDataColumn, I follow this RadAutoCompleteBox inside GridView example.

Works only when I editing an existent column, but I facing problems when I try to Insert a new row or when I Cancel any modifications.

When I need to insert a new record I call the method BeginInsert of GridView.

this.radGridView.BeginInsert();

It add a new empty row at the end, but then the autocomplete doesn't work anymore.

When I want edit an existing row, and suddenly I decide to cancel the edition; I press Esc key and the value of the column doesn't return to his original value.

I Attach an example of the solution, it has a button with click event, and in the event I call BeginInsert method.
I upload it to dropbox.

Many thanks.
Dimitrina
Telerik team
 answered on 05 Mar 2015
5 answers
113 views
Hi,

I have a custome aggregate function defined as follows. I would like to access the column name on which this particular function is being called from so that the function can act on that particular column. How can that be done? Currently I have hard-coded the column name('Score') which I do not want to do.

class Summation : AggregateFunction<BindableDynamicDictionary, int>
    {
        public Summation()
        {
            this.AggregationExpression = items => FindSum(items);
             
        }
 
        private int FindSum(IEnumerable<BindableDynamicDictionary> source)
        {
 
            var itemCount = source.Count();
            int sum = 0;
            if (itemCount >= 1)
            {
                var values = source.Select(i => i["Score"]);
                 
                foreach (int str in values)
                {
                    sum = sum + str;
                }
            }
 
            return sum;
        }
    }



Thanks
Dimitrina
Telerik team
 answered on 05 Mar 2015
6 answers
335 views
Hi,

I was wondering if there was a way to achieve column grouping similar to http://www.telerik.com/help/winforms/gridview-viewdefinitions-column-groups-view.html in WPF?

I have tried adding to the ChildGroups of the column groups but this doesn't seem to work the same way as the example in the above link.

The problem that I am seeing is that for column groups that do not have nested groups there appears to be an extra row added above each of these (to fill the space for those groups that do have children) which doesn't pick up my style and pushes the content of these groups down so not all of it is visible. What I would like to happen is that for the column groups that contain no nested groups is that the content of these cells fills the space without the extra row above it like the "Customer Contact" group in the winforms example in the link.

Thanks,

Steven
Dimitrina
Telerik team
 answered on 05 Mar 2015
1 answer
46 views
Hi there,

I just performed an upgrade from 2014 Q4 to 2015 Q1 and have run into an unexpected issue.  I have been using Panel Bar Item injection via the prism framework to place panel bar items for each of my modules under their respective headers.

In my shell, the regions are laid out as follows:

<telerik:RadPanelBar
                DockPanel.Dock="Left"
                Width="200"
                regions:RegionManager.RegionName="NavPanelRegion"
                Background="LightBlue">
                <telerik:RadPanelBarItem
                    regions:RegionManager.RegionName="NavPanelHomeRegion"
                    Header="Home">
                </telerik:RadPanelBarItem>
                <telerik:RadPanelBarItem
                    regions:RegionManager.RegionName="NavPanelToolsRegion"
                    Header="Tools">
                </telerik:RadPanelBarItem>
                <telerik:RadPanelBarItem
                    regions:RegionManager.RegionName="NavPanelMaintenanceRegion"
                    Header="Maintenance">
                </telerik:RadPanelBarItem>
                <telerik:RadPanelBarItem
                    regions:RegionManager.RegionName="NavPanelReportingRegion"
                    Header="Reporting">
                </telerik:RadPanelBarItem>
</telerik:RadPanelBar>

Then each of the modules has one to many panel bar items defined:

<telerik:RadPanelBarItem  x:Class="Modules.Dashboard.Views.DashboardPanelItemView"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:regions="http://www.codeplex.com/CompositeWPF"
             xmlns:vm="clr-namespace:Modules.Dashboard.ViewModels"
             Header="Homepage">
    <telerik:RadPanelBarItem.Resources>
        <vm:DashboardCommandViewModel x:Key="DashboardCommandVm" />
    </telerik:RadPanelBarItem.Resources>
    <telerik:RadPanelBarItem.Command>
        <Binding Source="{StaticResource DashboardCommandVm}" Path="Home" />
    </telerik:RadPanelBarItem.Command>
</telerik:RadPanelBarItem>

And during module initalization, the following is called:

public void Initialize()
        {
            Container.RegisterType<Object, Views.DashboardView>("DashboardView");
            this._regionViewRegistry.RegisterViewWithRegion(RegionNames.Navigation.HomeNavigationPanelRegion, typeof(Views.DashboardPanelItemView));
            this._regionViewRegistry.RegisterViewWithRegion("ContentRegion", typeof(DashboardView));
        }

Prior to the update, this worked just fine and the panel bar items were injected under their respective parents.  Now, though, post-upgrade, it's no longer functioning.

Any thoughts?
Petar Mladenov
Telerik team
 answered on 05 Mar 2015
2 answers
161 views
I have a simple pane factory which basically looks like this:

class PaneFactory : DockingPanesFactory
{
    protected override void AddPane(RadDocking radDocking, RadPane pane)
    {
        //Docking is UserControl, which contains RadDocking
        var docking = radDocking.ParentOfType<Docking>();
        var settings = pane.Tag as PaneSettings;
 
        if (settings.ScreenPosition == ScreenPosition.Left)
        {
            //LeftPaneGroup is pane group declared in xaml (docked to left side)
            docking.LeftPaneGroup.AddItem(pane, DockPosition.Center);
        }
        else
        {
            //DocumentPaneGroup is document host declared in xaml
            docking.DocumentPaneGroup.AddItem(pane, DockPosition.Center);
        }
    }
}

So there are two options: pane is either initially docked to the left or to the document host. If it is docked to document host - PaneStateChange
event is fired, but if it is docked to the left - there is no event. Is this a bug or an expected behaviour? Looks really inconsistent to me. Is there a way to force PaneStateChange event to always fire, when new pane is added?
Nikita
Top achievements
Rank 1
 answered on 05 Mar 2015
3 answers
112 views
Hi,
Connectors of some items are generated dynamically in run-time, so I tried to bind Connectors using Extension. Drag-drop process are definitely working good, but when I bind all diagram,before calling extension method, it throws exception "XmlParseException - The default connectors cannot be removed because connections are attached to it.".

Thanks in advance.

    public class ConnectorExtension
    {
 
        public static readonly DependencyProperty ConnectorsProperty =
            DependencyProperty.RegisterAttached("Connectors", typeof(List<ConnectorModel>), typeof(ConnectorExtension), new UIPropertyMetadata(null, new PropertyChangedCallback(ConnectorsChanged)));
 
 
 
        public static void SetConnectors(UIElement element, List<ConnectorModel> value)
        {
            element.SetValue(ConnectorsProperty, value);
        }
        public static List<ConnectorModel> GetConnectors(UIElement element)
        {
            return (List<ConnectorModel>)element.GetValue(ConnectorsProperty);
        }
 
 
        public static void ConnectorsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var connectors = e.NewValue as List<ConnectorModel>;
            var shape = d as RadDiagramShapeBase;
            if (shape != null )
            {
                if (connectors != null)
                {
                    shape.UseDefaultConnectors = false;
                    shape.Connectors.Clear();
                    connectors.ForEach(connector => shape.Connectors.Add(new RadDiagramConnector() { Offset = connector.Offset, Name = connector.Name, Tag=connector.Name }));
                }
                else
                {
                    shape.UseDefaultConnectors = false;
                    shape.Connectors.Clear();
                }
            }
        }
      
    }
}

<Style x:Key="DynamicConnectorStyle" TargetType="telerik:RadDiagramShape">
    <Setter Property="Position" Value="{Binding Position, Mode=TwoWay}"/>
    <Setter Property="IsSelected" Value="{Binding IsSelected}" />
    <Setter Property="Height" Value="{Binding Height}" />
    <Setter Property="Width" Value="{Binding Width}" />
    <Setter Property="Background" Value="Transparent" />
    <Setter Property="IsEditable" Value="False" />
    <Setter Property="StrokeThickness" Value="0" />
    <Setter Property="UseDefaultConnectors" Value="False"/>
    <Setter Property="extensions:ConnectorExtension.Connectors" Value="{Binding Path=Connectors,UpdateSourceTrigger=PropertyChanged}"/>
    <Setter Property="ContentTemplate" Value="{Binding Path=TemplateKey,Converter={StaticResource DataTemplateSelector}}" />
</Style>
Pavel R. Pavlov
Telerik team
 answered on 05 Mar 2015
1 answer
188 views
I have a rad ribbon view which has been configured to IsMinimizable to False, however double clicking on a ribbontab results in the ribbon view being set to minimized. Is this a known bug? Is there any known workarounds?

At present my only solution is setting isminimized to false in the minimizedchanged event, this still results in a small flicker of the panel.
Milena
Telerik team
 answered on 05 Mar 2015
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
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?