Telerik Forums
UI for WPF Forum
1 answer
98 views

Hi,

I'm using a RadMultiColumnComboBox and can't seem to be able to set the validation error template to Tooltip using:

telerik:ValidationErrorTemplateHelper.DisplayMode="ToolTip"

It always set the validation message on the right of the control, and in my case it's being clipped by the windows limits.

This usually works great on all other controls.

Thank you for your help

Stenly
Telerik team
 answered on 03 Jun 2024
0 answers
45 views

I'm getting a null reference exception when closing one of the pane and could not figure out why it is null in the RemovePane(RadPane pane) method.

We have override to that method,

protected override void RemovePane(RadPane pane)
        {
            if(pane.Header.ToString().ToLower()=="digital" || pane.Header.ToString().ToLower() == "analog")
                SaveDebugPaneLayout(pane);
            pane.DataContext = null;
            pane.Content = null;
            pane.ClearValue(RadDocking.SerializationTagProperty);
            pane.RemoveFromParent();
        }

And also the CreatePaneForItem method,

protected override RadPane CreatePaneForItem(object item)
        {
            var viewModel = item as DebugPaneViewModel;
            if (viewModel != null)
            {
                var pane = viewModel.IsDocument ? new RadDocumentPane() : new RadPane();

                pane.DataContext = item;
    
                if (viewModel.ContentType != null)
                {
                    if (viewModel.GetType().ToString().EndsWith("EditorViewModel")) 
                    {
                        if (pane.Content == null)
                        {
                            dynamic obj = Activator.CreateInstance(viewModel.ContentType);
                            pane.Content = obj;
                            obj.DataContext = viewModel;
                        }
                    }
                    else
                    {
                        pane.Content = Activator.CreateInstance(viewModel.ContentType);
                    }
                }

                RadDocking.SetSerializationTag(pane, viewModel.ID);
                return pane;
            }

            return base.CreatePaneForItem(item);
        }
How can I know which pane is null when it is executing the RemovePane(). I tried looking at when panes are being added but did not see anything suspicious.
boon
Top achievements
Rank 1
 asked on 31 May 2024
1 answer
65 views
Dear All,

I am using the RadAutoCompleteBox as follows. I would like to display all Products when pressing the "Keyboard Down Arrow" on the RadAutoCompleteBox. Is this possible?

 

<telerik:RadAutoCompleteBox Height="23" Width="180" Background="#FFEDF4AB" Margin="3,0,0,0" ItemsSource="{Binding Products}" SelectedItem="{Binding SelectedProductItem, Mode=TwoWay}" SelectionMode="Single" TextSearchMode="StartsWith" SearchText="{Binding Name, Mode=TwoWay}" TextSearchPath="Name" DisplayMemberPath="Name" AutoCompleteMode="Suggest" > <telerik:RadAutoCompleteBox.DropDownItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Name}" FontWeight="Bold" Foreground="Black" Width="200" /> </StackPanel> </DataTemplate> </telerik:RadAutoCompleteBox.DropDownItemTemplate> <Behaviors:Interaction.Triggers> <Behaviors:EventTrigger EventName="SelectionChanged"> <Behaviors:InvokeCommandAction Command="{Binding SelectProductCommand}" /> </Behaviors:EventTrigger> </Behaviors:Interaction.Triggers> </telerik:RadAutoCompleteBox>
Dimitar
Telerik team
 answered on 31 May 2024
0 answers
52 views

Hello,

is there a way to style the RadToolBarOverflowPanel? Or add a template for its items?

I would like to display the button on the left side and show the tooltip next to it.

Any help would be appreciated.

Best regards :)

 

Martin
Top achievements
Rank 1
 asked on 30 May 2024
1 answer
47 views

Hi, I have an issue trying to style RadDocking control.

I want that my PaneHeaders change their background when user selects them. I tried to modify RadPaneGroup ControlTemplate and RadPane Control Template, but with no luck. Could you please provide me detail sample for that?

One more question - how to correctly control height of the RadGroupHeader (Part where PaneHeaders *(tabs) are suited)? I simply dont understand which part of template should be responcible for that.

P.S. I am using Office 2019 theme.

Denis
Top achievements
Rank 1
Iron
 answered on 30 May 2024
0 answers
52 views

Can you please give a small example of "AStart Router" used in routing with tree layout.

 

Parth
Top achievements
Rank 1
Iron
Iron
 asked on 28 May 2024
0 answers
81 views

I have customized filtering control along with behavior,

Im trying to use SearchBox control in distinct values filter ive tried "EnableDistinctValuesFiltering="True""
even though i have search box it doest work,

example: in this screenshot ive type pending but the list still remains the same

 

 

here is my style

 

<Style TargetType="telerik:FilteringControl">
 <Setter Property="Background" Value="White" />
 <Setter Property="Template">
 <Setter.Value>
 <ControlTemplate TargetType="telerik:FilteringControl">
  <Border
   Margin="{TemplateBinding Margin}"
   Background="White"
   BorderBrush="{TemplateBinding BorderBrush}"
   BorderThickness="{TemplateBinding BorderThickness}"
   CornerRadius="1"
   TextBlock.FontSize="11"
   TextBlock.FontWeight="Normal">
  <Border
   Margin="1"
   Background="{TemplateBinding Background}"
   BorderBrush="LightGray"
   BorderThickness="1">
  <StackPanel
   MinWidth="200"
   MaxWidth="350"
   Margin="5"
   HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
   VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
  <StackPanel x:Name="PART_DistinctFilter">
<Grid>
<telerik:RadButton
 x:Name="PART_FilterCloseButton"
 Width="15"
 Height="15"
 Margin="0,2"
 Padding="1,-2,0,0"
 HorizontalAlignment="Right"
 Content="x"
 FontSize="10"
 FontWeight="Bold" />
</Grid>
<telerik:RadWatermarkTextBox
 x:Name="PART_SearchBox"
 Margin="0,0,0,4"
 CurrentText="{Binding SearchText, Mode=TwoWay, TargetNullValue=''}"
 WatermarkContent="{telerik:LocalizableResource Key=GridViewFilterDistinctValueSearch}">
<telerik:RadWatermarkTextBox.Style>
 <Style BasedOn="{StaticResource {x:Type telerik:RadWatermarkTextBox}}" TargetType="{x:Type telerik:RadWatermarkTextBox}">
 <Setter Property="Visibility" Value="Collapsed" />
 <Style.Triggers>
 <DataTrigger Binding="{Binding DataContext.FilterType, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, FallbackValue=Collapsed}" Value="CustomLOV">
 <Setter Property="Visibility" Value="Visible" />
 </DataTrigger>
 </Style.Triggers>
 </Style>
</telerik:RadWatermarkTextBox.Style>
</telerik:RadWatermarkTextBox>
<ListBox
 x:Name="PART_DistinctValuesList"
 MaxHeight="250"
 ItemsSource="{Binding DistinctValues}"
 ScrollViewer.HorizontalScrollBarVisibility="Auto"
 SelectionMode="Multiple">
<ListBox.ItemTemplate>
<DataTemplate>
    <CheckBox
        VerticalContentAlignment="Center"
        Content="{Binding ConvertedValue}"
        IsChecked="{Binding IsActive, Mode=TwoWay}">
        <CheckBox.LayoutTransform>
            <ScaleTransform ScaleX="0.9" ScaleY="0.9" />
        </CheckBox.LayoutTransform>
    </CheckBox>
</DataTemplate>
</ListBox.ItemTemplate>
    <ListBox.Style>
        <Style BasedOn="{StaticResource {x:Type ListBox}}" TargetType="{x:Type ListBox}">
            <Setter Property="Visibility" Value="Collapsed" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding DataContext.FilterType, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, FallbackValue=Collapsed}" Value="CustomLOV">
                    <Setter Property="Visibility" Value="Visible" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </ListBox.Style>
</ListBox>
</StackPanel>
<StackPanel Margin="0,2">
<TextBlock
    Margin="0,2,0,0"
    telerik:LocalizationManager.ResourceKey="GridViewFilterShowRowsWithValueThat"
    Foreground="Black">
    <TextBlock.Style>
        <Style BasedOn="{StaticResource {x:Type TextBlock}}" TargetType="{x:Type TextBlock}">
            <Setter Property="Visibility" Value="Visible" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding DataContext.FilterType, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, FallbackValue=Collapsed}" Value="CustomLOV">
                    <Setter Property="Visibility" Value="Collapsed" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </TextBlock.Style>
</TextBlock>
<telerik:RadComboBox
    x:Name="PART_Filter1ComboBox"
    Margin="0,2"
    ItemTemplate="{StaticResource ActionTemplate}"
    ItemsSource="{Binding AvailableActions}"
    SelectedItem="{Binding Filter1.Operator, Mode=TwoWay}">
    <telerik:RadComboBox.Style>
        <Style BasedOn="{StaticResource {x:Type telerik:RadComboBox}}" TargetType="{x:Type telerik:RadComboBox}">
            <Setter Property="Visibility" Value="Visible" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding DataContext.FilterType, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, FallbackValue=Collapsed}" Value="Condition">
                    <Setter Property="Visibility" Value="Collapsed" />
                </DataTrigger>
                <DataTrigger Binding="{Binding DataContext.FilterType, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, FallbackValue=Collapsed}" Value="CustomLOV">
                    <Setter Property="Visibility" Value="Collapsed" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </telerik:RadComboBox.Style>
</telerik:RadComboBox>
<TextBox
    x:Name="PART_Filter1TextBox"
    Height="30"
    Margin="0,2"
    Padding="3,0"
    VerticalContentAlignment="Center"
    Text="{Binding Filter1.Value, Mode=TwoWay, Converter={StaticResource CommonValueConverter}, ConverterParameter=FilteringControl}">
<TextBox.Style>
<Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="TextBox">
    <Setter Property="IsEnabled" Value="True" />
    <Setter Property="Visibility" Value="Visible" />
    <Style.Triggers>
        <DataTrigger Binding="{Binding ElementName=PART_Filter1ComboBox, Path=SelectedItem}" Value="IsNull">
            <Setter Property="IsEnabled" Value="False" />
        </DataTrigger>
        <DataTrigger Binding="{Binding DataContext.FilterType, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, FallbackValue=Collapsed}" Value="Condition">
            <Setter Property="Visibility" Value="Collapsed" />
        </DataTrigger>
        <DataTrigger Binding="{Binding DataContext.FilterType, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, FallbackValue=Collapsed}" Value="CustomLOV">
            <Setter Property="Visibility" Value="Collapsed" />
        </DataTrigger>
    </Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
<telerik:RadComboBox
    x:Name="CustomComboBox"
    Height="5"
    Margin="0,2"
    ItemsSource="{Binding DataContext.CustomFilterValues, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
    SelectedValue="{Binding Filter1.Value}"
    Text="{Binding Filter1.Value, UpdateSourceTrigger=PropertyChanged}">
<telerik:RadComboBox.Style>
<Style BasedOn="{StaticResource {x:Type telerik:RadComboBox}}" TargetType="{x:Type telerik:RadComboBox}">
    <Setter Property="Visibility" Value="Collapsed" />
    <Style.Triggers>
        <DataTrigger Binding="{Binding DataContext.FilterType, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, FallbackValue=Collapsed}" Value="Condition">
            <Setter Property="Visibility" Value="Visible" />
        </DataTrigger>
    </Style.Triggers>
</Style>
</telerik:RadComboBox.Style>
</telerik:RadComboBox>
<!--</StackPanel>-->
</StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button
  x:Name="PART_ApplyFilterButton"
  Grid.Column="0"
  Margin="0,2,2,2"
  telerik:LocalizationManager.ResourceKey="GridViewFilter" />
<Button
  x:Name="PART_ClearFilterButton"
  Grid.Column="1"
  Margin="2,2,0,2"
  telerik:LocalizationManager.ResourceKey="GridViewClearFilter" />
</Grid>
</StackPanel>
</Border>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

Dilip
Top achievements
Rank 1
 updated question on 27 May 2024
2 answers
85 views

I am attempting to use the desktop alert but instead of reacting to a click on the content I want a button.  How do I route this?

View Model Method; show the alert (works)

        private void ShowAlert()
        {
            if (IsShowAlert &&
                AlertTitle.IsNotNullOrEmpty() &&
                AlertText.IsNotNullOrEmpty())
            {
                // Create a new BitmapImage
                BitmapImage bitmap = new BitmapImage();
                bitmap.BeginInit();
                bitmap.UriSource = new Uri("pack://application:,,,/Images/GSI_Cloud_256.ico");
                bitmap.EndInit();

                var image = new System.Windows.Controls.Image() { Source = bitmap };

                desktopAlertManager.ShowAlert(new DesktopAlertParameters
                {
                    Header = AlertTitle,
                    Content = AlertText,
                    Icon = image,
                    IconColumnWidth = 48,
                    IconMargin = new Thickness(10, 0, 20, 0),
                    ShowDuration = AlertShowDuration,
                    Command = new DelegateCommand(OnAlertCommandExecuted)
                });
            }
        }

 
Respond to the Button Press:
        private void OnAlertCommandExecuted(object param)
        {
            IsShowTrayApp = true;
        }

Alert Style with a Button:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation">

    <SolidColorBrush x:Key="DesktopAlert_BorderBrush" Color="#FF848484"/>
    <LinearGradientBrush x:Key="DesktopAlert_Background" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="Cornsilk" Offset="0"/>
        <GradientStop Color="#FFD4D4D4" Offset="1"/>
    </LinearGradientBrush>
    <SolidColorBrush x:Key="DesktopAlert_InnerBorderBrush" Color="#FFFFFFFF"/>
    <CornerRadius x:Key="DesktopAlert_CornerRadius">1</CornerRadius>
    <SolidColorBrush x:Key="DesktopAlert_ButtonIconStroke" Color="#FFFFFFFF"/>
    <LinearGradientBrush x:Key="DesktopAlert_ButtonIconFill" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FF282828"/>
        <GradientStop Color="#FF7C7C7C" Offset="1"/>
    </LinearGradientBrush>

    <DataTemplate x:Key="RadDesktopAlertHeaderTemplate">
        <Grid 
            x:Name="Header" 
            Grid.Column="1" 
            Grid.Row="0" 
            VerticalAlignment="Top" 
            HorizontalAlignment="Stretch"
            Background="{StaticResource ContainerHeaderBackgroundBrush}">

            <StackPanel
                HorizontalAlignment="Left"
                Orientation="Horizontal">

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="30" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <Image 
                        RenderOptions.BitmapScalingMode="Fant"
                        Margin="5 0 5 0"
                        Source="/Images/GSI_Cloud_256.ico"/>

                    <Label
                        Grid.Column="1"
                        Foreground="White"
                        FontWeight="SemiBold"
                        FontSize="14"
                        VerticalContentAlignment="Center"
                        VerticalAlignment="Center"/>
                </Grid>
                
            </StackPanel>

            <StackPanel
                HorizontalAlignment="Right"
                Orientation="Horizontal">

                <Button Height="30" Width="30"  
	                x:Name="DesktopAlert_CloseButton" 
                    Content="🗙"
                    Background="Transparent"
                    BorderThickness="0"
                    Foreground="White"
                    FontSize="20"
                    Margin="0 -3 0 0"
                    FontWeight="Bold"
                    Command="{x:Static telerikNavigation:DesktopAlertCommands.Close}" />

            </StackPanel>

            <ContentPresenter 
                Content="{Binding}" 
                TextBlock.FontWeight="Bold" 
                Margin="0 0 0 0" 
                MinHeight="{Binding ActualHeight, ElementName=DesktopAlert_CloseButton}" Grid.RowSpan="2" VerticalAlignment="Top">

                <ContentPresenter.Resources>
                    <Style TargetType="{x:Type TextBlock}">
                        <Setter Property="TextWrapping" Value="Wrap"/>
                        <Setter Property="Foreground" Value="White" />
                        <Setter Property="VerticalAlignment" Value="Center" />
                        <Setter Property="HorizontalAlignment" Value="Left" />
                        <Setter Property="Margin" Value="30 0 0 0" />
                    </Style>
                </ContentPresenter.Resources>
            </ContentPresenter>

        </Grid>
    </DataTemplate>

    <ControlTemplate x:Key="RadDesktopAlertTemplate" TargetType="{x:Type telerikNavigation:RadDesktopAlert}">
        <Grid x:Name="LayoutRoot">
            <Border Background="White"
                    BorderThickness="{TemplateBinding BorderThickness}" 
                    CornerRadius="{StaticResource DesktopAlert_CornerRadius}">

                <Border BorderBrush="{StaticResource DesktopAlert_InnerBorderBrush}" BorderThickness="1">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="26" />
                        </Grid.RowDefinitions>
                        
                        <ContentPresenter 
                            ContentTemplate="{TemplateBinding HeaderTemplate}" 
                            Grid.Column="1" 
                            Content="{TemplateBinding Header}" 
                            Grid.Row="0" VerticalAlignment="Top"/>

                        <ContentPresenter 
                            x:Name="Content" 
                            Cursor="Hand" 
                            Grid.Column="1" 
                            HorizontalAlignment="Center" 
                            Margin="0 7 0 0" Grid.Row="1" VerticalAlignment="Top">

                            <ContentPresenter.Resources>
                                <Style TargetType="{x:Type TextBlock}">
                                    <Setter Property="TextWrapping" Value="Wrap"/>
                                    <Setter Property="TextTrimming" Value="CharacterEllipsis"/>
                                    <Setter Property="HorizontalAlignment" Value="Center" />
                                    <Setter Property="FontSize" Value="14" />
                                </Style>
                            </ContentPresenter.Resources>
                        </ContentPresenter>

                        <Grid Grid.Row="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="126" />
                            </Grid.ColumnDefinitions>

                            <Button
                                Style="{StaticResource ButtonStyle}"
                                Grid.Column="2"
                                Content="Open" 
                                Command="{Binding OnAlertCommandExecuted}"/>
                        </Grid>
                    </Grid>
                </Border>
            </Border>
        </Grid>
    </ControlTemplate>

    <Style TargetType="{x:Type telerikNavigation:RadDesktopAlert}">
        <Setter Property="Padding" Value="10 8"/>
        <Setter Property="Opacity" Value="0.9"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="FontFamily" Value="Segoe UI"/>
        <Setter Property="FontSize" Value="14"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="{StaticResource DesktopAlert_BorderBrush}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Width" Value="360"/>
        <Setter Property="Height" Value="130"/>
        <Setter Property="Template" Value="{StaticResource RadDesktopAlertTemplate}"/>
        <Setter Property="HeaderTemplate" Value="{StaticResource RadDesktopAlertHeaderTemplate}"/>
    </Style>
</ResourceDictionary>


 

 

 

Stenly
Telerik team
 answered on 24 May 2024
0 answers
87 views

RadRichTextBox is not allowing copy pasting from different document and also from another RadRichTextBox. 
If I am copying from same RadRichTextBox and then pasting it to same RadRichTextBox, then it is working fine.

So, I took reference from below doc:

WPF RichTextBox - Clipboard Support - Telerik UI for WPF

and implemented below function:

private void RadRichTextBox_CommandExecuting(object sender, CommandExecutingEventArgs e) 
{ 
    if (e.Command is PasteCommand) 
    { 
        e.Cancel = true; 
        // Obtain the document inside the clipboard 
        RadDocument document = ClipboardEx.GetDocument().ToDocument(); 
 
        // Change it according to your needs 
        document.Selection.SelectAll(); 
        RadDocumentEditor editor = new RadDocumentEditor(document); 
        editor.ChangeFontSize(Unit.PointToDip(12)); 
 
        // Insert it in RadRichTextBox 
        this.radRichTextBox.InsertFragment(new DocumentFragment(document)); 
    } 
} 


I observed that if I am copying from another doc and pasting to that RadRichTextBox then 

RadDocument document = ClipboardEx.GetDocument().ToDocument(); 

this line is giving System.NullReferenceException: 'Object reference not set to an instance of an object.'

How to fix this?

Shraddha
Top achievements
Rank 1
 asked on 24 May 2024
0 answers
54 views
Is the TableShape solution from the Demos application available for download? I've tried using the SDK samples browser and looking in Github repo. I can't find it. Also, does it support Drag and Drop?
Will
Top achievements
Rank 1
Iron
 asked on 23 May 2024
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?