Telerik Forums
UI for WPF Forum
2 answers
127 views

Hi,

I'm using the CellLoaded event to customize a RadGridView. Setting a background brush and foreground + fontweight for the TextBlock in the cell works as expected. I'm also using the AutoGeneratingColumn event to set a DataTemplate for a column.

Now I want to use DataTemplates for individual cells. But when I do so I have to set a DataTemplate for every cell, every time it's rendered. If I'm not setting a DataTemplate I get a random content from a random cell, everytime a cell is scrolled into view. If I'm using DataTemplates for all cells I can't edit the cells anymore.

 

Is there anything I can do to stop the RadGridView messing up my cells? Changing the virtualization settings didn't changed anything, even if I disabled virtualization (VirtualizingPanel.IsVirtualizing="False").

 

This is my GridView now:

<telerik:RadGridView AutoGenerateColumns="True"
                     VirtualizingPanel.VirtualizationMode="Recycling"                                     
                     Grid.Row="1"
                     x:Name="Gv"
                     Margin="0 20 10 0"
                     SelectionMode="Extended"
                     SelectionUnit="Cell"
                     CellLoaded="GvCellLoaded"
                     BeginningEdit="GvEditBegins"
                     CellEditEnded="CellEditEnded"
                     AutoExpandGroups="True"
                     GroupRenderMode="Flat"
                     ValidatesOnDataErrors="None"
                     telerik:TouchManager.TouchMode="None"
                     CanUserSortColumns="False"
                     CanUserSortGroups="False"
                     IsReadOnly="False"
                     AllowDrop="True"
                     ItemsSource="{Binding Items}"
                     FrozenColumnsSplitterVisibility="Collapsed"
                     ContextMenuOpening="GvContextMenuOpening"
                     ScrollViewer.VerticalScrollBarVisibility="Visible"
                     ScrollViewer.HorizontalScrollBarVisibility="Visible"
                     PreviewMouseRightButtonDown="GvRightMouseDown"
                     PreviewMouseLeftButtonDown="GvMouseDown"
                     PreviewMouseLeftButtonUp="GvMouseUp"
                     AutoGeneratingColumn="GvAutoGenerate">
Hendrik
Top achievements
Rank 1
Iron
 answered on 11 Jun 2024
1 answer
629 views

I was surprised when I downloaded the latest Q2 release to not find any folder with .NET 8 DLLs, only .NET 7.

NET 7 is already at "End of Support" as of May 14th according to Microsoft.

https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core

Considering NET 8 is designated as having LTS (long term support) from Microsoft I was wondering what Telerik's plans are regarding a NET 8 release of your WPF suite?

We would like to move from .NET 6 which we currently use, to .NET 8 which has LTS.

Martin Ivanov
Telerik team
 answered on 11 Jun 2024
0 answers
150 views

Hello,

 

I'm not sure if this is a bug or if this just isn't the way to change the OverrideColor for this case. I ran into an error when attempting to use the following:

<telerik:RadToggleButton Grid.Row="0" Background="Transparent" BorderThickness="0">
    <telerik:RadToggleButton.Content>
        <telerik:RadSvgImage Height="60" Width="60">
            <telerik:RadSvgImage.Style>
                <Style TargetType="telerik:RadSvgImage">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsChecked, RelativeSource={RelativeSource AncestorType=telerik:RadToggleButton}}" Value="False">
                            <Setter Property="UriSource" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:MainWindow}}, Path=PlusImagePath}"/>
                            <Setter Property="OverrideColor" Value="Blue"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding IsChecked, RelativeSource={RelativeSource AncestorType=telerik:RadToggleButton}}" Value="True">
                            <Setter Property="UriSource" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:MainWindow}}, Path=MinusImagePath}"/>
                            <Setter Property="OverrideColor" Value="Red"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </telerik:RadSvgImage.Style>
        </telerik:RadSvgImage>
    </telerik:RadToggleButton.Content>
</telerik:RadToggleButton>

My intention here is to have the OverrideColor change the color of the svg image I am also setting using UriSource. I get the following error only when going from IsChecked being true to being false.


System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Telerik.Windows.Controls
  StackTrace:
   at Telerik.Windows.Controls.RadSvgImage.OverrideColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) in Telerik.Windows.Controls\RadSvgImage.cs:line 414
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
   at System.Windows.StyleHelper.InvalidateDependents(Style ownerStyle, FrameworkTemplate frameworkTemplate, DependencyObject container, DependencyProperty dp, FrugalStructList`1& dependents, Boolean invalidateOnlyContainer)
   at System.Windows.StyleHelper.OnBindingValueInStyleChanged(Object sender, BindingValueChangedEventArgs e)
   at System.Windows.Data.BindingExpressionBase.ChangeValue(Object newValue, Boolean notify)
   at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
   at System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean isASubPropertyChange)
   at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
   at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
   at MS.Internal.Data.PropertyPathWorker.OnDependencyPropertyChanged(DependencyObject d, DependencyProperty dp, Boolean isASubPropertyChange)
   at MS.Internal.Data.ClrBindingWorker.OnSourceInvalidation(DependencyObject d, DependencyProperty dp, Boolean isASubPropertyChange)
   at System.Windows.Data.BindingExpression.HandlePropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
   at System.Windows.Data.BindingExpressionBase.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
   at System.Windows.Data.BindingExpression.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
   at System.Windows.DependentList.InvalidateDependents(DependencyObject source, DependencyPropertyChangedEventArgs sourceArgs)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   at System.Windows.DependencyObject.SetCurrentValueInternal(DependencyProperty dp, Object value)
   at System.Windows.Controls.Primitives.ToggleButton.OnToggle()
   at Telerik.Windows.Controls.RadToggleButton.OnClick() in Telerik.Windows.Controls\RadToggleButton.cs:line 201
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at Telerik.Windows.Controls.RadToggleButton.OnMouseLeftButtonUp(MouseButtonEventArgs e) in Telerik.Windows.Controls\RadToggleButton.cs:line 231
   at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run()
   at RadSVGImageTest.App.Main()

Perhaps this combination of setters isn't possible? I've attached an example project. Any help is appreciated.

 

Thank You,

Giuliano

Giuliano
Top achievements
Rank 1
Iron
 asked on 10 Jun 2024
1 answer
116 views

Hi,

I wanted to know if it is contemplated the possibility of drag and drop from a component such as the RadListBox for example to a RadGridView which has as RowDataTemplate another RadGridView. But, only allow to drag the activity of the RadListBox to the child RadGridView. How could I achieve that?

Thanks in advance.

 


<Window x:Class="ComponentesTestWPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:local="clr-namespace:ComponentesTestWPF"
        mc:Ignorable="d"
        Title="MainWindow">
    <Window.Resources>
        
        <!--Child grid (activities template)-->
        <DataTemplate x:Key="ChildTemplate">
            <Grid MaxWidth="800" HorizontalAlignment="Left" Margin="5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <telerik:RadButton Grid.Column="1" Width="25" Height="25" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,0,0,0" 
                                   Command="{Binding DataContext.Commands[DeleteCommand],RelativeSource={RelativeSource AncestorType=UserControl}}" 
                                   CommandParameter="{Binding }" ToolTipService.ToolTip="Delete">
                    <TextBlock Text="Delete"/>
                </telerik:RadButton>

                <telerik:RadGridView x:Name="ActiviesRadGridView" 
                                     Grid.Column="0" IsBusy="{Binding IsBusy}" ActionOnLostFocus="None" CanUserFreezeColumns="False" 
                                     SelectionMode="Single" MaxHeight="200" MinHeight="150" AutoGenerateColumns="False"
                                     ItemsSource="{Binding Activities, Mode=TwoWay}" 
                                     SelectedItem="{Binding SelectedActivity, RelativeSource={RelativeSource AncestorType=UserControl}, Mode=TwoWay}"
                                     FrozenColumnsSplitterVisibility="Collapsed" CanUserDeleteRows="True" NewRowPosition="None">

                    <telerik:RadGridView.RowStyle>
                        <Style TargetType="telerik:GridViewRow">
                            <Setter Property="telerik:DragDropManager.AllowDrag" Value="True" />
                        </Style>
                    </telerik:RadGridView.RowStyle>

                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding DescActivity}" Width="*" TextWrapping="Wrap" IsReadOnly="True"/>
                    </telerik:RadGridView.Columns>

                    <telerik:RadGridView.Resources >
                        <Style TargetType="telerik:GridViewRow" >
                            <Setter Property="AllowDrop" Value="True"/>
                            <Setter Property="telerik:DragDropManager.AllowDrag" Value="True"/>
                            <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True"/>
                        </Style>
                    </telerik:RadGridView.Resources>

                </telerik:RadGridView>

            </Grid>
        </DataTemplate>
    </Window.Resources>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        
        <!--Main grid (groups)-->
        <telerik:RadGridView x:Name="GroupsGridView"  Grid.Column="0"
                             SelectionMode="Extended" Margin="0,5,5,0" ActionOnLostFocus="None" CanUserFreezeColumns="False" 
                             ItemsSource="{Binding Group, Mode=TwoWay}" 
                             SelectedItem="{Binding SelectedGroup, Mode=TwoWay}"              
                             RowDetailsTemplate="{StaticResource ChildTemplate}" IsBusy="{Binding IsBusy}">

            <telerik:RadGridView.Columns>
                <telerik:GridViewToggleRowDetailsColumn ExpandMode="Multiple"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Description}" Width="*" TextWrapping="Wrap" IsReadOnly="True"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Quantity}" Width="Auto" TextWrapping="Wrap" IsReadOnly="True"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Info}" Width="Auto" TextWrapping="Wrap" IsReadOnly="True"/>
            </telerik:RadGridView.Columns>

            <telerik:RadGridView.Resources >
                <Style TargetType="telerik:GridViewRow" >
                    <Setter Property="AllowDrop" Value="False"/>
                    <Setter Property="telerik:DragDropManager.AllowDrag" Value="False"/>
                    <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="False"/>
                </Style>
            </telerik:RadGridView.Resources>
            
        </telerik:RadGridView>

        <!--ListBox (activities)-->
        <telerik:RadListBox x:Name="ActivitiesListBox" Grid.Column="1" Width="200" ItemsSource="{Binding ActivitiesList}" />
        
    </Grid>
</Window>


Stenly
Telerik team
 answered on 10 Jun 2024
1 answer
207 views

   I have a PDF file that's been imported into a MemoryStream object and now I need to display it using the Telerik UI for WPF pdfViewer control.  The existing documentation says that you can create a PdfDocumentSource object and bind the pdfViewer.DocumentSource to that.  However, either PdfDocumentSource no longer exists, or I can't figure out what the correct Namespace is.

   I'm using TelerikUI for WPF v2024 Q2.  However changelogs for 2020 (https://docs.telerik.com/devtools/wpf/controls/radpdfviewer/changes-and-backward-compatibility/backward-compatibility)  say that: 

Changed
Obsolete constructors of Telerik.Windows.Documents.Fixed.PdfDocumentSource:

PdfDocumentSource(Uri uri, FormatProviderSettings settings)
PdfDocumentSource(Stream stream, FormatProviderSettings settings)
What to do now
Use the overloads that accept Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.PdfImportSettings instead.

   I've also read that there is some kind of merge going on trying to replace the previous PDF code with Telerik.Windows.Documents.Fixed .  In any case, I can't seem to figure out how to go from a MemoryStream to something that the pdfViewer.DocumentSource likes.  

   Can anyone help with a very basic code sample to take a PDF as a memorystream and create something that pdfView.DocumentSource will accept?  Thank you!

 

Dimitar
Telerik team
 answered on 07 Jun 2024
1 answer
83 views

Hey guys! We are considering using RadGridView in our apps, but we have figure out next things: 

1. Is it possible to always keep a row in Non edit mode? In other words a user should double click on cells every time when he wants to edit a cell despite the selected row.
2. Is it possible to keep RadCheckBoxColumn is the edit mode? In this case a user should check or uncheck a checkbox by single click. 
3. Is it possible to go next row by Enter key and if it's the last row a new row should be added?
4. Does RadGridView have a functionality to select a column by clicking on the column header?

 
Stenly
Telerik team
 answered on 05 Jun 2024
1 answer
63 views
I am using the RadAutoCompleteBox control in a WPF application and need assistance with configuring it to search for items based on the Name property, but display the values from the Key property.
Stenly
Telerik team
 answered on 05 Jun 2024
2 answers
119 views

Hi. Curently I faced with an issue that I cannot correctly hide tab if I have only one RadPane in the window.

What I am trying to to is the following: I wish to have PaneHeader if I have only one RadPane in the group and hide it and show tabs if more thatn one RadPane. Also I want to completely hide everything if this RadPane is inside ToolWindow. (Similar to Bottom template, but with differ that tabs are on top)

What I have currently:

 

It works when I undock it to ToolWIndow, but fails when I dock it again in the right/left parts of the docking control. Seems binding in the trigger simply does not work.

I am attaching my TopRadPane group Template. Please, point me what I am doing wrong:

 


<ControlTemplate x:Key="RadPaneGroupTopControlTemplate" TargetType="telerikDocking:RadPaneGroup">
        <Grid>
            <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <dock:RadGridResizer x:Name="DockResizer" Placement="Left" ShowsPreview="True" Visibility="Collapsed"/>
        <Border
                x:Name="HeaderTabs"
                Grid.Column="1">
            <Grid x:Name="ItemsContainer" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <ItemsPresenter x:Name="ItemsPresenterElement" Margin="0"/>
                <telerik:RadButton x:Name="CloseButton"
                                   Grid.Column="1"
                                   Command="telerikDocking:RadDockingCommands.Close"
                                   Style="{StaticResource RadButtonDocumentCloseStyle}"
                                   Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanToVisibilityConverter}}"/>
            </Grid>
            <Border.Style>
                <Style TargetType="Border">
                    <Setter Property="BorderThickness" Value="1" />
                    <Setter Property="Visibility" Value="Visible"/>
                    <Style.Triggers>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadPaneGroup}, Path=IsInToolWindow}" Value="true" />
                                <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadPaneGroup}, Path=IsSingleItem}" Value="true" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Visibility" Value="Collapsed" />
                        </MultiDataTrigger>
                    </Style.Triggers>
                </Style>
            </Border.Style>
            
        </Border>
        <dock:PaneHeader Grid.Column="1" 
                         x:Name="HeaderElement" 
                         SelectedPane="{TemplateBinding SelectedPane}"
                         Visibility="Collapsed">
            <!-- <dock:PaneHeader.Style> -->
            <!--     <Style TargetType="dock:PaneHeader" BasedOn="{StaticResource PaneHeaderStyle}"> -->
            <!--         <Setter Property="Visibility" Value="Collapsed"/> -->
            <!--         <Style.Triggers> -->
            <!--             <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=telerik:RadPaneGroup}, Path=., Converter={StaticResource HeaderVisibilityConverter}}" Value="True"> -->
            <!--                 <Setter Property="Visibility" Value="Visible"/> -->
            <!--             </DataTrigger> -->
            <!--         </Style.Triggers> -->
            <!--     </Style> -->
            <!-- </dock:PaneHeader.Style> -->
        </dock:PaneHeader>
        <Border x:Name="BorderVisual"
                Grid.Column="1"
                Grid.Row="1"
                Grid.RowSpan="1"
                BorderThickness="{TemplateBinding BorderThickness}"
                BorderBrush="{TemplateBinding BorderBrush}"
                Background="{TemplateBinding Background}"/>
        <Border x:Name="AccentBorderVisual"
                Grid.Column="1"
                Grid.Row="1"
                Grid.RowSpan="1"
                BorderThickness="{TemplateBinding BorderThickness}"
                BorderBrush="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(helpers:ThemeHelper.CheckedBrush)}"
                Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedPane.IsActive, Converter={StaticResource BooleanToVisibilityConverter}}"/>
        <Grid Grid.Row="1" Grid.Column="1">
            <ContentPresenter x:Name="ContentElement"
                    Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsContentPreserved, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"
                    ContentTemplate="{TemplateBinding SelectedContentTemplate}"
                    ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                    Margin="{TemplateBinding Padding}"/>
            <Grid x:Name="ContentElementsPanel" Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsContentPreserved, Converter={StaticResource BooleanToVisibilityConverter}}"/>
        </Grid>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="SplitterPosition">
                <Trigger.Value>
                    <Dock>Left</Dock>
                </Trigger.Value>
                <Setter TargetName="DockResizer" Property="Visibility" Value="Visible"/>
                <Setter TargetName="DockResizer" Property="Grid.RowSpan" Value="3"/>
                <Setter TargetName="DockResizer" Property="Placement" Value="Left"/>
                <Setter TargetName="DockResizer" Property="MinWidth" Value="10"/>
            </Trigger>
            <Trigger Property="SplitterPosition">
                <Trigger.Value>
                    <Dock>Top</Dock>
                </Trigger.Value>
                <Setter TargetName="DockResizer" Property="Visibility" Value="Visible"/>
                <Setter TargetName="DockResizer" Property="Grid.ColumnSpan" Value="2"/>
                <Setter TargetName="DockResizer" Property="Placement" Value="Top"/>
                <Setter TargetName="DockResizer" Property="MinHeight" Value="10"/>
                <Setter TargetName="DockResizer" Property="VerticalAlignment" Value="Top"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="ContentElement" Property="Opacity" Value="{telerik:Office2019Resource ResourceKey=DisabledOpacity}"/>
                <Setter Property="Foreground" Value="{telerik1:Office2019Resource ResourceKey=DisabledForegroundBrush}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

Denis
Top achievements
Rank 1
Iron
 answered on 04 Jun 2024
1 answer
91 views

I have a list of <Data>, which I use to bind to a VirtualGrid
Data: 

   -Value [InnerData]: 

      -- Name [string]

      -- Description [string]

 

I use CellTemplateNeeded event handler to select a DataTemplate for the columns : 

private void RadVirtualGrid_CellTemplateNeeded(object sender, CellTemplateEventArgs e)

{

e.DataTemplate = this.Resources["Template"] as DataTemplate;

}

        <DataTemplate x:Key="Template">
            <StackPanel>
                <Label Content="{Binding Name}" />
                <Label Content="{Binding Description}" />
            </StackPanel>
        </DataTemplate>


And then I use CellValueNeeded to set the Value:

private void RadVirtualGrid_CellValueNeeded(object sender, CellValueEventArgs e)

{

e.Value = viewModel.List[e.RowIndex].Value;

}


So, basically I want to be able to "bind" an object to the Value of the Column.

Then, I want to display multiple properties of the object in the DataTemplate. 

 

It works fine with string data, for e.g.:

e.Value = viewModel.List[e.RowIndex].Value.Name

<Label Content="{Binding }" />


It doesn't work with objects:

e.Value = viewModel.List[e.RowIndex].Value

<Label Content="{Binding Name}" />

A workaround was to "bind" to a string which contains both properties, $"{name}--#--{description}", then use a converter to get the name and description and display it. 
But, I want to be able to pass an object, as I might need to display multiple properties. 

Is there a limitation here? Can you recommend a better way to do it? 

Thanks 

Mihai Adrian
Top achievements
Rank 1
Iron
 answered on 04 Jun 2024
0 answers
81 views

In my project, there is radrichtextbox. I am trying to change fontfamily and basealignment of the text present inside the radrichtextbox whenever that radrichtextbox loads using below code.

radRichTextBox.FontFamily = new System.Windows.Media.FontFamily("Symbol");
radRichTextBox.ChangeBaselineAlignment(Telerik.Windows.Documents.Model.BaselineAlignment.Subscript);

 

But I see no change in the text. Am I missing something?

Shraddha
Top achievements
Rank 1
 asked on 04 Jun 2024
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
Security
VirtualKeyboard
HighlightTextBlock
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?