Telerik Forums
UI for WPF Forum
3 answers
161 views

Hi @ all,

In the last WPF build the DataForm control got changed (single, multiple editors).
But this change broke some other functionality of the control.

I attached a screenshot of small test project when using controls from version 2020.3.1020
And also the screenshot when using controls from version 2021.1.119

This is basically the XAML code I used for the view:

<Window
    x:Class="TelerikDataFormTest.MainWindow"
    Title="MainWindow"
    Width="525"
    Height="350">
    <Window.Resources>
 
        <DataTemplate x:Key="DataFormEditTemplate">
            <StackPanel Margin="10">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.5*" />
                        <ColumnDefinition Width="0.5*" />
                    </Grid.ColumnDefinitions>
 
                    <StackPanel Grid.Column="0">
                        <telerik:DataFormDataField DataMemberBinding="{Binding DataName}" Label="Name" />
                        <telerik:DataFormDataField Label="Date">
                            <telerik:RadDatePicker SelectedValue="{Binding DataDate}" TodayButtonVisibility="Visible" />
                        </telerik:DataFormDataField>
 
                        <telerik:DataFormDataField Label=" ">
                            <telerik:RadButton
                                Width="250"
                                Margin="0,5,0,5"
                                HorizontalAlignment="Left"
                                Content="Test Button" />
                        </telerik:DataFormDataField>
                    </StackPanel>
 
                    <StackPanel Grid.Column="1">
                        <telerik:DataFormDataField DataMemberBinding="{Binding DataName}" Label="Name" />
                        <telerik:DataFormDataField Label="Date">
                            <telerik:RadDatePicker SelectedValue="{Binding DataDate}" TodayButtonVisibility="Visible" />
                        </telerik:DataFormDataField>
 
                        <telerik:DataFormDataField Label=" ">
                            <telerik:RadButton
                                Width="250"
                                Margin="0,5,0,5"
                                HorizontalAlignment="Left"
                                Content="Test Button" />
                        </telerik:DataFormDataField>
                    </StackPanel>
                </Grid>
            </StackPanel>
        </DataTemplate>
 
        <DataTemplate x:Key="DataFormReadOnlyTemplate">
            <StackPanel Margin="10">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.5*" />
                        <ColumnDefinition Width="0.5*" />
                    </Grid.ColumnDefinitions>
 
                    <StackPanel Grid.Column="0">
                        <telerik:DataFormDataField DataMemberBinding="{Binding DataName}" Label="Name" />
                        <telerik:DataFormDataField Label="Date">
                            <telerik:RadDatePicker SelectedValue="{Binding DataDate}" TodayButtonVisibility="Visible" />
                        </telerik:DataFormDataField>
 
                        <telerik:DataFormDataField Label=" ">
                            <telerik:RadButton
                                Width="150"
                                Margin="0,5,0,5"
                                HorizontalAlignment="Left"
                                Content="Test Button" />
                        </telerik:DataFormDataField>
                    </StackPanel>
 
                    <StackPanel Grid.Column="1">
                        <telerik:DataFormDataField DataMemberBinding="{Binding DataName}" Label="Name" />
                        <telerik:DataFormDataField Label="Date">
                            <telerik:RadDatePicker SelectedValue="{Binding DataDate}" TodayButtonVisibility="Visible" />
                        </telerik:DataFormDataField>
 
                        <telerik:DataFormDataField Label=" ">
                            <StackPanel>
                                <telerik:RadButton
                                    Width="150"
                                    Margin="0,5,0,5"
                                    HorizontalAlignment="Left"
                                    Content="Test Button" />
                            </StackPanel>
                        </telerik:DataFormDataField>
 
                    </StackPanel>
                </Grid>
            </StackPanel>
        </DataTemplate>
 
    </Window.Resources>
 
 
    <Grid>
 
 
        <telerik:RadDataForm
            Width="400"
            Height="300"
            HorizontalAlignment="Left"
            VerticalAlignment="Top"
            AutoEdit="True"
            AutoGenerateFields="False"
            CurrentItem="{Binding Data}"
            EditTemplate="{StaticResource DataFormEditTemplate}"
            ReadOnlyTemplate="{StaticResource DataFormReadOnlyTemplate}" />
 
    </Grid>
</Window>

Until the change this worked for years now and is also used in our projects.
The question is: Is this a bug or a wanted behaviour of this control.
If there won't be a chance to use the old setting somehow we're stuck with the old version from now on.

I'm really looking forward to your suggestion on this topic.

Kind Regards,
Thomas

Martin Ivanov
Telerik team
 answered on 12 Mar 2021
2 answers
180 views
Can I remove or lock so that the user only can use RGB?
Fredrik
Top achievements
Rank 1
Veteran
Iron
 answered on 12 Mar 2021
2 answers
136 views

Version 2020.3.1020.310

I know BindingList is old from WinForms but why does it behave differently to ObservableCollection<T> and is it correct? 

Take this xaml and the code and run it.  When a new row is added the SelectedItem changes before accepting the new row.  Press escape twice to cancel the new row and the SelectedItem does not change, it is still set to the now canceled item.  Change the ItemsSource Binding from `TradeBindingList` to `Trades` and repeat.  You'll notice that SelectedItem is not changed when adding a new row.  This latter behavior is much more preferable and is correct as it does not leave the SelectedItem incorrect.  Why is this? 

        <telerik:RadGridView ItemsSource="{Binding TradeBindingList}" IsSynchronizedWithCurrentItem="True" CanUserInsertRows="True" NewRowPosition="Top" SelectedItem="{Binding SelectedTrade, Mode=TwoWay}"
                             AutoGenerateColumns="False">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding TradeNumber}"></telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>     
        </telerik:RadGridView>

 

    public partial class MainWindow : Window, INotifyPropertyChanged
    {
        object selectedTrade;

        public MainWindow()
        {
            InitializeComponent();
            Trades = new ObservableCollection<Trade>
            {
                new Trade(),
            };
            TradeBindingList = new BindingList<Trade>
            {
                new Trade(),
            };
            DataContext = this;
        }

        public ObservableCollection<Trade> Trades { get; set; }
        public BindingList<Trade> TradeBindingList { get; set; }

        public object SelectedTrade
        {
            get => selectedTrade;
            set
            {
                selectedTrade = value;
                Debug.WriteLine("Selected changed");
                OnPropertyChanged();
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        [NotifyPropertyChangedInvocator]
        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    public class Trade : ViewModelBase
    {
        public Trade()
        {
            TradeNumber = "1";
        }
        public string TradeNumber { get; set; }
    }

Scott Waye
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 10 Mar 2021
6 answers
357 views
I am able to dynamically show/hide all elements of the chart trackball info on a chart except for the trackball line.  That element I cannot seem to change once the chart is showing.  

Here is where I set the line style of the trackball line just as recommended in Telerik's article.  The only difference is that did not set the visiblity to a hard-coded value.  Instead I bound it to a dependency property on my control using my well-tested bool-to-visiblity converter

<tk:RadCartesianChart x:Name="Chart"  >
 
    <tk:RadCartesianChart.TrackBallLineStyle>
        <Style TargetType="Polyline">
            <Setter Property="Visibility"
                Value="{Binding ElementName=Root, Path=ShowInfo, Converter={StaticResource CvtBoolToVis}}" />
        </Style>
    </tk:RadCartesianChart.TrackBallLineStyle>


Unfortunately that Visiblity binding in the line style is only evaluated the very first time the chart displays.  AFter that, it doesn't matter if I change that boolean "ShowInfo" property or not.  The binding never gets re-evaluated.

I've put a breakpoint in my converter to make sure it gets evaluated correctly the first time. 
I've put a breakpoint in the dependency property to verify that it truly does change.  And I even bind properties of the TrackBallBehavior to that very same ShowInfo property and their bindings DO get re-evaluated when it changes so I know that works.

<tk:ChartTrackBallBehavior ShowIntersectionPoints="{Binding ElementName=Root, Path=ShowInfo}"
                           ShowTrackInfo="{Binding ElementName=Root, Path=ShowInfo}"
                           SnapMode="ClosestPoint"
                            />



So how can I dynamically show/hide the trackball line?
Dilyan Traykov
Telerik team
 answered on 10 Mar 2021
2 answers
241 views

I would like to tweak the timeline to have it work as a "slider" for a video editing like behavior. I have made some tests and tweaks but there are a couple of points I don't manage to tweak:

1. Having a thumb position which can be set by click.

I have managed to display a bar that can move from code using the annotations and a negative margin but I would like to know if there is a way to make it work like a slider thumb (i.e. click or drag&drop)?

2. I have some trouble to find how to use custom interval type to display the text every X seconds but keep some ticks at a smaller interval (see timeline 1).

3. Is it possible to display only specific times (for example beginning and ending time) either on the ruler or as on timeline 3 image?

Note that I am using the NuGet packages and Fluent Dark Theme.

Dilyan Traykov
Telerik team
 answered on 10 Mar 2021
3 answers
153 views
We are looking for a way to manually resize the submenu for items that have a very large collection of menu items.  Sometimes, these lists are long enough that the submenu ends up taking up the entirety of the vertical space on screen, including the taskbar.  We'd like to limit the height of the submenus to the size of the current workspace, effectively allowing the panel to scroll more through the content and display less at a time.

A solution in xaml is not sufficient, as these submenus are dynamically populated in code.  We already have code set up to determine what we'd like to set the height of the submenu's panel to, but despite trying many ways of getting ahold of the correct components in code, we have been unable to successfully modify the submenu panel's height.

Anybody know of a good solution for this?
Vladimir Stoyanov
Telerik team
 answered on 10 Mar 2021
4 answers
218 views

I'm trying to build a worksheet header section with will be roughly six row.

Where cell A1 will have a fontsize of 20 and in green.

Cell D1 will be a date and time as a string.

Cell A2 will have some data, A3 blank, A4 some string, A5 some string.

Row 7 have the column header.

Not clear on how this work. My test code failed. Not understanding how Telerik walks through Cell's rows and column. Can you help with what documentation to read and samples to use?

herb
Top achievements
Rank 1
Veteran
Iron
 answered on 10 Mar 2021
1 answer
164 views

Hi,

we have a MVVM Scenario, where changes in the Raddiagram need to be reflected in the underlying viewmodel.

For shapes and connections that is easy, because we can implement IObservableGraphSource and contruct the necessary objects. ConnectionPoints however seem tricky. While moving a point triggers a ConnectionManipulationEvent, adding or deleting points via CTRL+Click apparently do not trigger this event?

I do realize that, even though it only exposes IList, ConnectionPoints is actually an ObeservableCollection and with this knowledge I can hack my way around this, but then adding a new Point causes this collection to reset and add all points one by one again, which is also not really what I want to do in my Viewmodel.

Is there an easier way to reflect these changes (adding/removing ConnectionPoints) back into the viewmodel properly, without having to create a custom ConnectionManipulationTool wihich notifies on such changes?

Thanks in advance!

Regards

Martin Ivanov
Telerik team
 answered on 10 Mar 2021
2 answers
382 views

I have a FilePathPicker with the FilePath property set to a two-way binding to a view-model property.  Whenever (in code-behind) I  set the corresponding bound property (and then Raise a PropertyChanged notification for it), the FilePath in the text box does not update, no matter what the UpdateSourceTrigger.  I cannot understand why.

I went and wrote a test application and reproduced the same effect.  Isn't the FilePath property supposed to work as a two-way binding?

Here is the XAML binding.

<tk:RadFilePathPicker FilePath="{Binding ReportHeaderImagePath, Mode=TwoWay}" IconVisibility="Collapsed"/>

 

 

And here is the bound property in the ViewModel

 

private string _reportHeaderImagePath;
 
public string ReportHeaderImagePath
{
    get => Settings.ReportHeaderImagePath;
    set
    {
        _reportHeaderImagePath = value;
        RaisePropertyChanged(nameof(ReportHeaderImagePath));
    }
}


When my code sets this ReportHeaderImagePath property to null or string.Empty, I can see the value being set in the debugger and I can see the PropertyChanged event being raised.   But still the editor in the RadFilePathPicker does not change.  The previous path stays there.   I have to either manually edit it or click the little "X" button inside it.

I have tried setting the Binding's UpdateSourceTrigger value all possible choices Default, LostFocus, PropertyChanged and even Explicit.  Nothing works.  

What am I missing?

 

Joe
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 09 Mar 2021
2 answers
299 views

The SyntaxEditor is great! I'd like to use it inside a LayoutControl though, basically like this:

    <telerik:RadLayoutControl >
        <telerik:LayoutControlGroup Orientation="Vertical">
            <telerik:LayoutControlGroup Orientation="Horizontal">
                <telerik:LayoutControlSplitter />
                <telerik:RadSyntaxEditor />
            </telerik:LayoutControlGroup>
            <telerik:LayoutControlSplitter />
        </telerik:LayoutControlGroup>
    </telerik:RadLayoutControl>

I have that working with a fixed size editor, but it would be much nicer if the editor resized when the splitters were moved. However, if I don't make the editor fixed size I get the error "Placing RadSyntaxEditor in a panel or control that measures it with infinite height is not supported unless height is set to the control".

Is there a work-around for this? If not, could you add support in a future release?

Regards,

Georg

 

 


 

Georg
Top achievements
Rank 1
Veteran
 answered on 09 Mar 2021
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?