Telerik Forums
UI for WPF Forum
2 answers
164 views

Hi Telerik team,

I would like to have the foreground of the series labels same as the series color.

Below picture is the expected result:

 

Would you please help me how to obtain this?

Many thanks,

Minh Tuan.

minh
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 09 Feb 2022
0 answers
106 views

I followed the instructions in this post to group based on data.

I modified the Github example AlternationRowStyleSelector  I changed the Club.cs code slightly to create a more manageable dataset for this example.

I used reflection to inspect the data in a property on the model.  For this example I looked at the data in the "Est." column.  I want to change the style when the value changes. 

Here is the modified code from AlternationRowStyle.cs

    public Style RowStyle { get; set; }
    public Style AltRowStyle { get; set; }
    public string PropertyName { get; set; }

    public override Style SelectStyle(object item, DependencyObject container)
    {
      var items = ((GridViewRow)container).GridViewDataControl.Items;

      Type t = item.GetType();
      PropertyInfo[] props = t.GetProperties();
      var currentItemValue = props.First(n => n.Name == PropertyName)?.GetValue(item, null);
      int currentItemIndex = items.IndexOf(item);
      if (currentItemIndex > 0)
      {
        var previousItem = items[currentItemIndex - 1];
        var previousItemValue = props.First(n => n.Name == PropertyName)?.GetValue(previousItem, null);
        if (currentItemValue.Equals(previousItemValue))
        {
          return RowStyle;
        }
        else
        {
          return AltRowStyle;
        }
      }

      return RowStyle;

Modified section of MainWindow.xaml

    <my:AlternationRowStyle x:Key="myRowStyle" PropertyName="Established" >
      <my:AlternationRowStyle.AltRowStyle>
        <Style TargetType="telerik:GridViewRow">
          <Setter Property="Background" Value="Gray"/>
        </Style>
      </my:AlternationRowStyle.AltRowStyle>
    </my:AlternationRowStyle>


As you can see the AltRowStyle is being activated when the value of a row is different from the one above it.  This isn't quite what I want.  I want to change styles when the value changes.  Specifically the seventh line above should be white not gray.   I tried a different approach where I used a boolean in the style selector and toggled it.  This works as desired.

Modified StyleSelector SelectStyle method.

    public override Style SelectStyle(object item, DependencyObject container)
    {
      var items = ((GridViewRow)container).GridViewDataControl.Items;

      Type t = item.GetType();
      PropertyInfo[] props = t.GetProperties();
      var currentItemValue = props.First(n => n.Name == PropertyName)?.GetValue(item, null);
      int currentItemIndex = items.IndexOf(item);
      if (currentItemIndex > 0)
      {
        var previousItem = items[currentItemIndex - 1];
        var previousItemValue = props.First(n => n.Name == PropertyName)?.GetValue(previousItem, null);
        if (!currentItemValue.Equals(previousItemValue))
        {
          altRowToggle = !altRowToggle;
        }
      }

      return altRowToggle ? this.AltRowStyle : this.RowStyle;
    }

If you make the window smaller so that you have to scroll, then scroll up and down a couple times to force it to redraw the items and run the style selector, it can get off track.

I realize the scrolling behavior is caused by my using a boolean in an attempt to keep track of the style to use.  When shrinking the grid, it re-evaluates the style selector based on the visible rows and determines which style to use but the toggle is in a state from the previous evaluation.

Is there a better way to achieve the desired result?

 

Thanks,

Chris

Chris
Top achievements
Rank 1
 asked on 08 Feb 2022
1 answer
146 views

Hello,

In the ListBoxDragDropBehavior documentation, it is said:
The ListBoxDragDropBehavior supports copying the dragged items if the Control key is pressed. For that purpose the CopyDraggedItems method should be overridden

But the behavior supports copying the dragged items without changing anything!

This is a problem because, in my case, I need to avoid the copying of the dragged items in all cases.
How can I do it?

Martin Ivanov
Telerik team
 answered on 08 Feb 2022
0 answers
139 views

Currently i am using RadGridView control in one of my project. I need some clarification for below items,

  • How to filter column values based on background color as well as actual value?
  • If not possible means, then how to create custom filter for color filter with existing filter option.

I have already spent lot of time on it. But i didnt find an exact solution. Could you please help me on this?

Note :

I have tried below options,

  • Used "FilterMemberPath" to map another property .
  • Created custom control for color filter. But not able to use exisitng functionality.

Thanks in advance.

Ranjith Kumar
Top achievements
Rank 1
 updated question on 08 Feb 2022
1 answer
413 views

How I can do server-side paging/sorting/filtering in a RadDataGrid. I retrieve the data from an azure function and I don't want to retrieve all data from the database. I pass as a parameter to the azure function, the page index, and the page size.  the response returns the result of the LINQ query with Skip(page index) and Take(page Size), and total row count.

Thank you for your help.

Martin Ivanov
Telerik team
 answered on 07 Feb 2022
1 answer
111 views

Hey, I'm building an app using Telerik for WPF, I want to minimize a tab when a variable change(using data binding) and I cannot find any answers across the web.

When I set the isHidden property to true, I can't set it back to false(because when isHidden set to true, the pane is removed from the visual tree), so I tried many other things to conditional minimizing the pane but didn't figure it out.

Sincerely, Omer

  
Dilyan Traykov
Telerik team
 answered on 07 Feb 2022
2 answers
243 views

Hello.

In radgridview i change the colors of the cells in the cellloaded event, which wotks fine, but

is there any way to use doubleanimate the backgroudn color of a cell?

 

This is how i color now:

 

Private Sub dgw_PL_CellLoaded(sender As Object, e As CellEventArgs) Handles dgw_PL.CellLoaded
        If TypeOf e.Cell Is GridViewHeaderCell Or TypeOf e.Cell Is GridViewFooterCell Then
            Exit Sub
        End If
        If e.Cell.Column.DisplayIndex < 7 Then
            e.Cell.Background = Brushes.LightSteelBlue
        End If
        Dim G As Telerik.Windows.Controls.GridView.GridViewCell = e.Cell
        If e.Cell.Column.UniqueName.ToString.ToUpper.Contains("DEM") Then
            If e.Cell.Column.DisplayIndex > 6 AndAlso (G.Content.text = "0" Or G.Value > 0) Then
                G.Background = New SolidColorBrush(Color.FromRgb(200, 255, 215))
            End If
        End If
End Sub

 

How could i make it for example blink between two colors, with doubleanimation?

 

Thanks

Peter

Peter
Top achievements
Rank 1
Iron
Iron
 answered on 06 Feb 2022
7 answers
526 views
Hi,
AutoComplete with Filtering doesn't seem to be working!
Is this a known issue?

thanks,
Steve

<

 

 

telerik:RadComboBox IsEditable="True" IsFilteringEnabled="True" >

 

 

 

 

<telerik:RadComboBoxItem Content="a1" /><telerik:RadComboBoxItem Content="abc" /><telerik:RadComboBoxItem ntent="b1" />

 

 

 

 

<telerik:RadComboBoxItem Content="b2" />

 

 

 

 

</telerik:RadComboBox>

 

Ron
Top achievements
Rank 1
Iron
 updated answer on 05 Feb 2022
0 answers
96 views

Hi,

I'm using SeriesDescriptorSelector + SeriesDesciptor i order to create series.

Based on the viewmodel info. the axis series are also created on when the series are  created, on CreateInstanceCore method.

Evething works fin except the axis TitleTemplate.

 

protected override ChartSeries CreateInstanceCore(object context)
        {
            IChartSerieViewModel viewModel = context as IChartSerieViewModel;
            var result = base.CreateInstanceCore(context);
            viewModel.ChartSeries = result;

            var scl = (viewModel.ChartSeries as ScatterLineSeries);

            scl.HorizontalAxis = new LinearAxis();
            scl.HorizontalAxis.DataContext = viewModel.SerieSettings.HorizontalAxis;
            viewModel.SerieSettings.HorizontalAxis.Bind(scl.HorizontalAxis);

            scl.VerticalAxis = new LinearAxis();
            scl.VerticalAxis.DataContext = viewModel.SerieSettings.VerticalAxis;

            return result;
        }

 

 

here is the Bind method

 

 public void Bind(CartesianAxis axis)
        {
            if (axis == null)
                return;

            SetLabelIntervalAxisBinding(axis, nameof(LabelInterval), this);
            SetLabelFormatAxisBinding(axis, nameof(LabelFormat), this);
            SetTitleAxisBinding(axis, nameof(Title), this);
            SetVisbilityBinding(axis, nameof(IsVisible), this);
            if (axis is LinearAxis)
            {
                SetMaxAxisBinding(axis as LinearAxis, nameof(Maximum), this);
                SetMinAxisBinding(axis as LinearAxis, nameof(Minimum), this);
            }
            if (axis is CategoricalAxis)
            {
                (axis as CategoricalAxis).PlotMode = Telerik.Charting.AxisPlotMode.OnTicksPadded;
                (axis as CategoricalAxis).MajorTickInterval = 1;
            }
            SetColorAxisBinding(axis, nameof(AxisColor), this);

            var rers = axis.FindResource("AxisTemplateTitle");

            axis.TitleTemplate = Application.Current.Resources["AxisTemplateTitle"] as DataTemplate;
        }

 

like I said, the binding works fine,, but even if the TitleTemplate is set, the chart won't display the title.

 

Any info is highly appreciated.

 

Thank you

Cosmin
Top achievements
Rank 1
 asked on 04 Feb 2022
1 answer
166 views

I have used the provided CategoryViewModel to implement RadTreeView tristate logic with checkboxes and also Enable/disable of some items by using isChecked and isEnabled properties.

Now  i need to implement Expand and Collapse when i check a parent item (subcategory item )

Could you pls suggest which events and how to use.

jyostna
Top achievements
Rank 1
Iron
 answered on 04 Feb 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?