Telerik Forums
UI for WPF Forum
3 answers
655 views

Hello

In a release of WPF after 2015.2.728 (up to and including 2020.2.617) the ability to programatically set the DisplayIndex of a GridViewColumn was broken, in what seems to be a bug (it used to work fine, and I'm not sure what behaviour you could achieve with this bug in place).  I haven't pinpointed the release, as a lot of releases have happened during that time!

I've attached a simple example which demonstrates this bug, you just have to change the boolean constant in the code behind file from `false` to `true`, and you'll see that the group header no longer shows.  If you go back to release 2015.2.728 then this works, but now it only works if you set DisplayIndex to -1 (anything else causes an argument exception, as there's a mismatch to the number of columns, which makes sense).  If you don't have the header group then you can obviously change the DisplayIndex as required, but as soon as you do, it breaks the header grouping.

I'd post the code solution if I could, but it's pretty simple, you don't even need the public class in my code behind, that's there just to make the column group header obvious.

 

Thanks!

Jimmy
Top achievements
Rank 1
 answered on 18 Nov 2020
2 answers
280 views

I have an application with a UserControl that contains a ListBox. The DataTemplate of the ListBox adds a button to each item. The ListBox is inside a BusyIndicator. If I set IsBusy to true from a command bound to a ListBox item the BusyIndicator does not show. If I set IsBusy from the constructor of the UserControl it does show. I am hoping you can tell me why it doesn't show from the command bound from the button.

Here is the xaml for the UserControl:

<UserControl
    x:Class="BusyIndicatorIssue.WidgetView"
    xmlns:local="clr-namespace:BusyIndicatorIssue"
    mc:Ignorable="d"
    d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.DataContext>
        <local:WidgetViewModel/>
    </UserControl.DataContext>
    <UserControl.Resources>
        <local:WidgetView x:Key="topLevelParent"/>
        <DataTemplate x:Key="WidgetListBoxDataTemplate">
            <DockPanel>
                <telerik:RadPathButton
                    DockPanel.Dock="Right"
                    PathGeometry="{telerik:RadGlyph Glyph=}"
                    Command="{Binding Source={StaticResource topLevelParent}, Path=DataContext.RunLongProcessCommand}"
                    CommandParameter="{Binding}"/>
                <TextBlock DockPanel.Dock="Left" FontSize="2" VerticalAlignment="Center" Text="{Binding Name}"/>
            </DockPanel>
        </DataTemplate>
    </UserControl.Resources>
    <telerik:RadBusyIndicator
        BusyContent="{Binding BusyContent}"
        IsBusy="{Binding IsBusy}"
        IsIndeterminate="True">
        <telerik:RadListBox
            x:Name="WidgetListBox" Padding="8"
            ItemsSource="{Binding Widgets, Mode=TwoWay}"
            ItemTemplate="{StaticResource WidgetListBoxDataTemplate}"/>
    </telerik:RadBusyIndicator>
</UserControl>

 

Here is the ViewModel code:

using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
using Telerik.Windows.Controls;
 
namespace BusyIndicatorIssue
{
    public class WidgetViewModel : ViewModelBase
    {
        public WidgetViewModel()
        {
            Widgets = new ObservableCollection<Widget>
            {
                new Widget("Widget 1"),
                new Widget("Widget 2"),
                new Widget("Widget 3"),
                new Widget("Widget 4"),
                new Widget("Widget 5"),
                new Widget("Widget 6"),
                new Widget("Widget 7"),
                new Widget("Widget 8"),
                new Widget("Widget 9")
            };
            RunLongProcessCommand = new DelegateCommand(OnRunLongProcessCommandExecuted);
            //BusyContent = "Doing Something";
            //IsBusy = true;
        }
 
        public DelegateCommand RunLongProcessCommand { get; set; }
        public ObservableCollection<Widget> Widgets { get; set; }
 
        public const string IsBusyPropertyName = "IsBusy";
        private bool _isBusy;
        public bool IsBusy
        {
            get => _isBusy;
            set
            {
                if (_isBusy != value)
                {
                    _isBusy = value;
                    RaisePropertyChanged();
                }
            }
        }
 
        public const string BusyContentPropertyName = "BusyContent";
        private string _busyContent = default!;
        public string BusyContent
        {
            get => _busyContent;
            set
            {
                if (_busyContent != value)
                {
                    _busyContent = value;
                    RaisePropertyChanged();
                }
            }
        }
 
        private void OnRunLongProcessCommandExecuted(object parameter)
        {
            var widget = (Widget)parameter;
            IsBusy = true;
            BusyContent = $"Doing something with {widget}";
            var backgroundWorker = new BackgroundWorker();
            backgroundWorker.DoWork += DoWork;
            backgroundWorker.RunWorkerCompleted += RunWorkerCompleted;
            _ = MessageBox.Show($"About to do something with {widget.Name}.");
            backgroundWorker.RunWorkerAsync(widget);
        }
 
        private void DoWork(object sender, DoWorkEventArgs e)
        {
            var widget = (Widget)e.Argument;
            System.Threading.Thread.Sleep(3000);
            _ = MessageBox.Show($"Done with {widget.Name}.");
        }
 
        private void RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            var backgroundWorker = sender as BackgroundWorker;
            if (backgroundWorker is not null)
            {
                backgroundWorker.DoWork -= DoWork;
                backgroundWorker.RunWorkerCompleted -= RunWorkerCompleted;
                InvokeOnUIThread(() => { IsBusy = false; });
            }
        }
    }
}

 

Here is the MainWindow xaml that hosts the UserControl:

<Window x:Class="BusyIndicatorIssue.MainWindow"
        xmlns:local="clr-namespace:BusyIndicatorIssue"
        mc:Ignorable="d"
        Height="300" Width="400"
        Title="MainWindow">
    <DockPanel>
        <local:WidgetView
            DockPanel.Dock="Top"
            HorizontalAlignment="Stretch"
            VerticalAlignment="Stretch"/>
    </DockPanel>
</Window>

 

This is the simple model I am using for testing:

namespace BusyIndicatorIssue
{
    public class Widget
    {
        public Widget(string name)
        {
            Name = name;
        }
        public string Name { get; set; }
    }
}

 

I was able to get the BusyIndicator to show by calling a command bound to a button placed directly in the main content of the UserControl. But I really need this application to have the buttons on each ListItem if possible.

 

Regards,

Don

Dilyan Traykov
Telerik team
 answered on 18 Nov 2020
1 answer
662 views

Hello,

I set up my telerik nuget server according to your documentation.
But, I can't find the Ui.for.Wpf.45 package.

I just find the .Wpf.netCore package.

Can you help me.

Thank you

best regards

Markus

 

Vesko
Telerik team
 answered on 17 Nov 2020
1 answer
244 views

Hi,

I just started valuating RADGrdiView.

grid is binded to a datatable.

-When editing a cell in a row and then moving to the next row, is there a way to not automatically going into edit mode ?

-When on the last row, is there a way to move to the new(which is at the button) without pressing (Insert) or clicking on the new row using the mouse? meaning is it possible to navigate to the new row using the keyboard arrows for example.

 

Thanks

Vladimir Stoyanov
Telerik team
 answered on 17 Nov 2020
2 answers
504 views
Hello there,

I want to be able to auto-resize a RadPane inside a RadDocking and RadSplitContainer up to the remaining place, when other sibling RadPanes get undocked and moved away per Drag&Drop.

Please, take a look at the attached code snippet for more info.

01.<telerik:RadDocking x:Name="dockEngineering" 
02.        Grid.Row="1"
03.        Margin="0,0,0,0"                                   
04.        BorderThickness="0"
05.        Padding="0"
06.        Background="{StaticResource LightGrayBrush}"
07.        x:FieldModifier="public">
08.    <telerik:RadDocking.DocumentHost>
09.        <telerik:RadSplitContainer x:Name="MiddleContainer">
10.            <telerik:RadPaneGroup x:Name="MiddleGroup">
11.                <telerik:RadPane x:Name="ProgressPane" Header="Progress View" >
12.                    <Grid Name="grdProgress">
13.                        <local:ProgressView DataContext="{Binding ProgressViewModel}"/>
14.                    </Grid>
15.                </telerik:RadPane>
16.            </telerik:RadPaneGroup>
17.        </telerik:RadSplitContainer>
18.    </telerik:RadDocking.DocumentHost>
19.</telerik:RadDocking>

There are other RadPanes parallel to ProgressPane, and 3 more RadSplitContainers parallel to RadDocking.DocumentHost inside RadDocking.
As said, when one of the other gets collapsed and more space is available at that docking position, I want the other RadPanes to stretch in size to take over that space.

How can I do this? Thanks.

Regards,
Baris
Hans
Top achievements
Rank 1
 answered on 17 Nov 2020
3 answers
422 views

I've got a RadGridView that contains a RowStyleSelector and an InputBindings section. The RowStyleSelector has 2 conditions, one checking if a value is true and one checking if a value is false. In the false case, the only thing being done is setting the style to be based on the existing GridViewRowStyle with no changes. In the true case, the same happens but the background color is changed. When the false case is used, my InputBindings work fine. Once the true case is used, though, my InputBindings stop working. (Related, I also use behaviors via Microsoft.Xaml.Behaviors.Wpf, with one of them being to bind a command to the MouseDoubleClick event, and that event also stops firing when the above happens with the InputBindings.)

I had set a breakpoint in my code to see if it the command was getting hit and it would only be hit when the false case happened above.

In the below example, assume that Items contains a Cond boolean property:

<telerik:RadGridView GroupRenderMode="Flat" IsReadOnly="True" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Items, Mode=OneWay}" RowIndicatorVisibility="Collapsed" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" ShowGroupPanel="False">
    <telerik:RadGridView.RowStyleSelector>
        <telerik:ConditionalStyleSelector>
            <telerik:StyleRule Condition="Cond">
                <Style BasedOn="{StaticResource GridViewRowStyle}" TargetType="{x:Type telerik:GridViewRow}">
                    <Setter Property="Background" Value="Orange"/>
                </Style>
            </telerik:StyleRule>
            <telerik:StyleRule Condition="!Cond">
                <Style BasedOn="{StaticResource GridViewRowStyle}" TargetType="{x:Type telerik:GridViewRow}"/>
            </telerik:StyleRule>
        </telerik:ConditionalStyleSelector>
    </telerik:RadGridView.RowStyleSelector>
    <telerik:RadGridView.InputBindings>
        <KeyBinding Key="Enter" Command="{Binding SelectItemCommand, Mode=OneTime}" />
        <KeyBinding Key="Tab" Command="{Binding SelectItemCommand, Mode=OneTime}" />
    </telerik:RadGridView.InputBindings>
</telerik:RadGridView>
Dilyan Traykov
Telerik team
 answered on 16 Nov 2020
8 answers
421 views

I am using "UI for WPF Q1 2016".

I am creating a RadDocument and I set the font to Calibri prior to adding anything:

         var doc = new RadDocument();
         // can't do real formatting without setting Paged
         doc.LayoutMode = DocumentLayoutMode.Paged;
         doc.Style.SpanProperties.FontSize = Unit.PointToDip(BodyFontSizePts);
         doc.Style.SpanProperties.FontFamily = new System.Windows.Media.FontFamily("Calibri");
Windows.Media.FontFamily("Calibri");

 

When I save as docx and open in Word, all is good.

When I open a modal dialog based on the RadRichTextBox, the ribbon bar says "Verdana".

When I save my multi-page document as PDF, the first page is obviously Verdana and the second page is obviously Calibri.

All I want is Calibri consistently throughout the document.

Thanks.

-John.

 

Reilly
Top achievements
Rank 1
Veteran
 answered on 13 Nov 2020
1 answer
231 views

Hello,

We have a gridview filled with production steps. These production steps can be reordered. For this we have implemented a behavior like the "Reorder Rows" behavior in your examples.These productions steps have a status field, that describe the step needs to be done or is done. the production steps will have to be processed from top to bottom 

The steps with status done do not need to be dragged and dropped, and the steps with status not done should never be dropped before a step with status done.

Is there a way to disable drag and drop for specific rows or cancel drop on specific rows?

Best regards and thanks for your help

Martin Ivanov
Telerik team
 answered on 13 Nov 2020
3 answers
599 views

Hi,

Is there any way to display the new NotifyIcon in an application that doesn't have any window?

I tried putting it in app.xaml like this:

<ResourceDictionary>
            <telerik:RadNotifyIcon x:Key="NotifyIcon"
                                   x:Name="NotifyIcon"         
                                   ShowTrayIcon="True"         
                                   TooltipContent="Test"         
                                   TrayIconSource="/TestNotifyIcon;component/SDK icon.ico"         
                                   GuidItem="020fea20-de2d-411f-87dd-111cd1e4f7fb">
            </telerik:RadNotifyIcon>
        </ResourceDictionary>

 

And then in App.xaml.cs:

public partial class App : Application
    {
        private RadNotifyIcon _taskbarIcon;
 
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
 
            _taskbarIcon = (RadNotifyIcon)FindResource("NotifyIcon");
        }
 
        protected override void OnExit(ExitEventArgs e)
        {
            if (_taskbarIcon != null)
                _taskbarIcon.Dispose();
 
            base.OnExit(e);
        }
    }

 

But the icon does not display...

We are currently using Hardcodet.NotifyIcon.Wpf package for this, and with that component this kind of code works, but we would like to use the Telerik component instead!

Regards
Andreas

Martin Ivanov
Telerik team
 answered on 13 Nov 2020
1 answer
175 views

Hi, I am new in telerik and (front-end). For my app I want to create dynamic Rad Cartisian chart ,fill it with scatter data points dynamically such that each data point should have predefined color. and store that dynamic created chart in tileview.

Problem is in assigning colors to each point. I would be very grateful if you can guide me in code.

  public RadTileViewItem CreateScatterPlotTile()
        {
            var chart = new Telerik.Windows.Controls.RadCartesianChart();
            var verticalaxis = new Telerik.Windows.Controls.ChartView.LinearAxis();
            var horizentalaxis = new Telerik.Windows.Controls.ChartView.LinearAxis();
            verticalaxis.Visibility = System.Windows.Visibility.Hidden;
            horizentalaxis.Visibility = System.Windows.Visibility.Hidden;

            chart.VerticalAxis = verticalaxis;

            chart.HorizontalAxis = horizentalaxis;

            ScatterPointSeries scatterSeries = new ScatterPointSeries();
            for (int i = 0; i < 100; i++)
            {
                ScatterDataPoint point = new ScatterDataPoint();
                point.XValue = xvaluelist[i];
                point.YValue = yvaluelist[i];
                scatterSeries.DataPoints.Add(point);
            }        
            chart.Series.Add(scatterSeries);
            var tile = new RadTileViewItem();
            tile.Content = chart;

            return tile;
        }  

 

Similarly I have color value list, How can I add colors from my list to each point.

Martin Ivanov
Telerik team
 answered on 12 Nov 2020
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?