Telerik Forums
UI for WPF Forum
1 answer
110 views

Is it possible to change height of all rows of a virtualized RadGridView in runtime (e.g. when user clicks a button)?

I tried to do this by changing height of every element of ChildrenOfType<GridViewRow>, but this affects only rows which are currently displayed. 

Switching virtualization off is not an option due to size of the grid.

Thanks

Martin Ivanov
Telerik team
 answered on 26 May 2023
1 answer
167 views

I am utilizing the RadGridView's export to Excel functionality, and I have encountered an issue where the footer of my grid is not being exported correctly.

In my implementation, I have a Footer for the GridViewDataColumn that uses a TextBlock control, and I have applied a binding to the Text property of this TextBlock. This TextBlock shows up perfectly when viewing the grid within the application. However, when I export the grid to Excel, the content of the TextBlock from the Footer appears in the Excel file as "System.Windows.Controls.TextBlock" rather than the actual expected value.

Here is the XAML for the GridViewDataColumn footer:

<telerik:GridViewDataColumn.Footer>
    <TextBlock
        Text="{Binding Path=ItemsSource, RelativeSource={RelativeSource AncestorType=telerik:RadGridView}, Converter={StaticResource QiYesValueToCountConverter}, ConverterParameter=IK_2_1_2, UpdateSourceTrigger=PropertyChanged}"
        FontSize="20"
        ToolTip="{Binding ElementName=UserControl1, Path=DataContext.IkItemsSummary.IK_2_1_2}" />
</telerik:GridViewDataColumn.Footer>

And here is the method I use for the export:

private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
    string extension = "xlsx";
    SaveFileDialog dialog = new SaveFileDialog()
    {
        DefaultExt = extension,
        Filter = String.Format("{1} Dateien (*.{0})|*.{0}", extension, "Excel"),
        FilterIndex = 1,
        FileName = "QI-Auswertungen"
    };
    if (dialog.ShowDialog() == true)
    {
        using (Stream stream = dialog.OpenFile())
        {
            RadGridView1.ExportToXlsx(stream);
        }
    }
}

I have tried a few potential solutions, such as using a ContentControl instead of a TextBlock and tried using the ElementExporting and ElementExported events to manipulate the exported value directly. However, I am still facing the same issue.
Stenly
Telerik team
 answered on 26 May 2023
1 answer
435 views

Hi team

I have created sample with RadNavigationView, below this i have added list of items and those has been bind using itemsource property.

ItemSource type has two property 1st name as NameDisplay with type string and 2 nd as Icon with type string

Create style like below

<Style TargetType="telerik:RadNavigationViewItem">
        <Setter Property="Content" Value="{Binding NameDisplay}" />
        <Setter Property="Icon">
            <Setter.Value>
                <Image Source="{Binding Icon}" Height="25" Width="25" MinWidth="20" MinHeight="20" />
            </Setter.Value>
        </Setter>
<Style>

Output Image

 

Why the 1st icon is now showing after the render.

 

This is the behavior? if yes

Is there any alternate way to use our custom png icon under RadNavigationViewItem? without using glyph icon

 

Thanks

Narendran S

Stenly
Telerik team
 answered on 24 May 2023
1 answer
92 views

I am using a RadHorizontalLinearGauge and a RadVerticalLinearGauge in a WPF UserControl. Each of these controls has 7 properties that are bound, Min, Max, MajorTickStep, MiddleTicks, StartTickOffset, EndTickOffset, and LabelFormat to DependencyProperties. As I drag an image back and forth in the UI (pan), the gauge control properties get updated accordingly. Please refer to the attached image.  The performance can be pretty sluggish because I think the controls update after every property update instead of all at once.  What I need is the old WinForms BeginUpdate/EndUpdate functions, but I don't think the equivalent functionality exists in WPF. Do you have any suggestions on how I can improve the performance?

 

Vladimir Stoyanov
Telerik team
 answered on 23 May 2023
1 answer
229 views

Hi, i am converting our app datagrids to RadGridViews and we need to change the colour of the row based on the previous row data. We used a multibinding ad passed "PreviousData" as the relative source:


                    <Style TargetType="DataGridRow">
                        <Style.Triggers>
                            <DataTrigger Value="True" >
                                <DataTrigger.Binding >
                                    <MultiBinding Converter="{StaticResource EvaluatePreviousRow}">
                                        <Binding RelativeSource="{RelativeSource PreviousData}"/>
                                        <Binding Path="."/>
                                    </MultiBinding>
                                </DataTrigger.Binding>
                                <Setter Property="Background" Value="Gray"/>
                            </DataTrigger>
                        </Style.Triggers>
                        <Setter Property="Background" Value="Red"/>
                    </Style>

Now i managed to convert everything so that the EvaluatePreviousRow converter is called when a row is being drawn by the RadGridView but now 

<Binding RelativeSource="{RelativeSource PreviousData}"/>

Always sends null to the converter. Is there any way to pass the previous collection item data in a similar fashion?

Stenly
Telerik team
 answered on 22 May 2023
1 answer
262 views

Hi,

im unable to change my RadGridView language to French. Following this page :

https://docs.telerik.com/devtools/wpf/common-information/common-localization

I wrote this in the App.xaml.cs : 

Thread.CurrentThread.CurrentCulture = new CultureInfo("fr");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr");
Telerik.Windows.Controls.LocalizationManager.DefaultCulture = new CultureInfo("fr");

Then my RadGridView control have the "Language="fr" tag in the xaml.

The language of the filters are still in English.

I can see a dll called "Telerik.Windows.Controls.resources.dll in the documentation but can't find it anywhere.

Thank you

Martin Ivanov
Telerik team
 answered on 19 May 2023
1 answer
134 views

Hello,

I am dealing with a minor bug on my pages that have a hidden panel that I show when adding new items. It shows the selected item, but also includes the text afterwards. It only happens when the dropdown visibility is collapsed. When I am populating the dropdowns I have tried setting  AutoCompleteProvider.SearchText = string.Empty and AutoCompleteProvider.MatchText = string.Empty and setting the panel to visible and then populating the value, but I cannot figure out how to clear out the text. What is a good work around for this bug. 

 I have attached an example project. To replicate my issue click "Populate Dropdown" then click "Toggle Visibility". If you toggle visibility before populating the issue will not occur. 
Stenly
Telerik team
 answered on 19 May 2023
1 answer
133 views

I need to translate the following xaml code into c# to build the real-time graph, but I always get reported that there are no series defined. If instead I directly use the xaml code in binding with my object it works regularly. Where am I doing wrong?

 

                <TK:RadCartesianChart x:Name="RadCartesianChart"
                                      Margin="0,18,0,0"
                                      Palette="Windows8">
                    <TK:RadCartesianChart.HorizontalAxis>
                        <TK:CategoricalAxis LabelInterval="15"
                                            ShowLabels="True" />
                    </TK:RadCartesianChart.HorizontalAxis>

                    <TK:RadCartesianChart.VerticalAxis>
                        <TK:LinearAxis LabelInterval="15"
                                       ShowLabels="True" />
                    </TK:RadCartesianChart.VerticalAxis>

                    <TK:RadCartesianChart.SeriesProvider>
                        <TK:ChartSeriesProvider Source="{Binding Path=grafico[0].dataSERIE, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}">
                            <TK:ChartSeriesProvider.SeriesDescriptors>
                                <TK:CategoricalSeriesDescriptor CategoryPath="etichetta"
                                                                ItemsSourcePath="dataITEM"
                                                                ValuePath="valore">
                                    <TK:CategoricalSeriesDescriptor.Style>
                                        <Style TargetType="TK:BarSeries">
                                            <Setter Property="LegendSettings">
                                                <Setter.Value>
                                                    <TK:SeriesLegendSettings Title="{Binding Path=serie, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </TK:CategoricalSeriesDescriptor.Style>
                                </TK:CategoricalSeriesDescriptor>
                            </TK:ChartSeriesProvider.SeriesDescriptors>
                        </TK:ChartSeriesProvider>
                    </TK:RadCartesianChart.SeriesProvider>
                </TK:RadCartesianChart>

 

C# code

 

            RadCartesianChart ctrl = new RadCartesianChart() { Name = "RadCartesianChart" };
            ctrl.Palette = ChartPalettes.Windows8;
            ctrl.VerticalAxis = new LinearAxis() { ShowLabels = true, LabelInterval = 15 };
            ctrl.HorizontalAxis = new CategoricalAxis() { ShowLabels = true, LabelInterval = 15 };

            ChartSeriesProvider series = new ChartSeriesProvider()
            {
                Source = new Binding("grafico[0].dataSERIE") { Mode = BindingMode.OneWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged },
            };

            CategoricalSeriesDescriptor seriesDescriptor = new CategoricalSeriesDescriptor
            {
                ItemsSourcePath   = "dataITEM",
                CategoryPath      = "etichetta",
                ValuePath         = "valore",
                Style = new Style(typeof(BarSeries))
            };
            seriesDescriptor.Style.Setters.Add(new Setter(BarSeries.LegendSettingsProperty,
                                                          new Binding("serie") { Mode = BindingMode.OneWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }));
            series.SeriesDescriptors.Add(seriesDescriptor);
            ctrl.SeriesProvider = series;

Object data

        public ObservableCollection<OGRecGrafico> grafico
        {
            get { return _grafico; }
            set { _grafico = value; RaisePropertyChanged(() => grafico); }
        }
        private ObservableCollection<OGRecGrafico> _grafico = new ObservableCollection<OGRecGrafico>();

publicclassOGRecGrafico : NotificationObject { publicstring titolo { get; set; } public ObservableCollection<OGRecGraficoSerie> dataSERIE { get; set; } = new ObservableCollection<OGRecGraficoSerie>(); } publicclassOGRecGraficoSerie : NotificationObject { publicobject serie { get; set; } public ObservableCollection<OGRecGraficoItem> dataITEM { get; set; } = new ObservableCollection<OGRecGraficoItem>(); } publicclassOGRecGraficoItem : NotificationObject { publicobject serie { get { return _serie; } set { _serie = value; RaisePropertyChanged(() => serie); } } privateobject _serie = null; publicobject etichetta { get { return _etichetta; } set { _etichetta = value; RaisePropertyChanged(() => etichetta); } } privateobject _etichetta = null; publicobject valore { get { return _valore; } set { _valore = value; RaisePropertyChanged(() => valore); } } privateobject _valore = null; publicstring scriptSQL { get { return _scriptSQL; } set { _scriptSQL = value; RaisePropertyChanged(() => scriptSQL); } } privatestring _scriptSQL = null; }


 

Martin Ivanov
Telerik team
 answered on 19 May 2023
1 answer
233 views

Hi 

Currently I am trying to change the height of the GridViewColumnGroup from a global style,

Right now the height is being altered but its not quite I am looking for.

This is the current result Where the header is no longer vertically aligned 

These are the global style tags

The desired result is for the Height value to be changed via a data trigger and the group header to be aligned vertically in the center

Any assistance here would be appreciated 

Stenly
Telerik team
 answered on 19 May 2023
0 answers
132 views

I'm facing an issue with the RadMenu control. I have a requirement where I need to display a menu with collapsible items, and I would like some guidance on how to implement this functionality.

Here's a simplified example of my current XAML code:

<telerik:RadMenu>
    <telerik:RadMenuItem Header="Menu">
        <telerik:RadMenuGroupItem ItemsSource="{Binding Alist}" Header="A"/>
        <telerik:RadMenuGroupItem ItemsSource="{Binding Blist}" Header="B"/>
    </telerik:RadMenuItem>
</telerik:RadMenu>

In this example, I have two RadMenuGroupItems, "A" and "B", each bound to a separate list (Alist and Blist respectively). Currently, the items are displayed in an expanded state by default.

However, I would like to achieve the following behavior:

1. Initially, all the items in the lists should be collapsed, i.e., hidden.

2. Users should be able to expand and collapse the items by clicking on the respective RadMenuGroupItem headers. When the header is clicked, the items should toggle between being expanded (visible) and collapsed (hidden).

Is there a built-in way to achieve this behavior in the RadMenu or RadMenuGroupItem controls? If not, could you please provide some guidance on how I can implement this functionality myself?

I appreciate any assistance or code examples you can provide to help me accomplish this requirement.

Thank you in advance for your help.

Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
 updated question on 18 May 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?