Telerik Forums
UI for WPF Forum
1 answer
157 views

Hello, Is there a way to bind the sort index to a property?
For example, we have the following class

public class Foo
{
    public string Name { get; set; }
    public int SortIndex { get; set; }
}

If the user clicks a column header and turns it to ascending order then the the SortIndex of the items should be updated with respect to how it was sorted in the UI.

Thanks!

Jan

Dinko | Tech Support Engineer
Telerik team
 answered on 09 May 2019
1 answer
237 views

UI for WPF 2019.1.220.45, Windows 10 Pro 64, Visual Studio Community 2019 v16.0.3

I'm trying to attach a context menu to a draggable listbox item, and after a great deal of effort, I've finally gotten it to the point where I can right click anywhere on the item (except for when the cursor is over a control with its own context menu, which is desired behavior).  So, this is functioning exactly as I want it to from a UI standpoint.  The problem is that the moment I add a Click property to the menu item in the xaml, the app throws an exception during the construction of the listbox.

Here's the xaml

<UserControl x:Class="MIDIMan.ZWMIDIInPortList"
             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:local="clr-namespace:MIDIMan"
             xmlns:viewmodel="clr-namespace:MIDIManViewModel;assembly=MIDIManViewModel"
             xmlns:telerikDragDrop="clr-namespace:Telerik.Windows.Controls.DragDrop;assembly=Telerik.Windows.Controls"
             mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="800" BorderBrush="Black" BorderThickness="1">
    <UserControl.Resources>
        <viewmodel:InPortsViewModel x:Key="InPortsViewModel"/>
        <DataTemplate x:Key="InPortListTemplate">
            <Grid HorizontalAlignment="Left">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <CheckBox IsChecked="{Binding IsActive}" />
                <TextBox Grid.Column="1" Text="{Binding PortName}" Width="Auto" BorderBrush="White" />
            </Grid>
        </DataTemplate>
        <Style x:Key="DraggableListBoxItem" TargetType="telerik:RadListBoxItem">
            <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />
            <Setter Property="ContextMenu">
                <Setter.Value>
                    <ContextMenu>
                        <MenuItem Header="Restore port name" Click="MenuItem_Click"/>
                    </ContextMenu>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition Width="65"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Text="Input Ports" HorizontalAlignment="Center"/>
        <TextBlock Grid.Row="1" Grid.Column="0" Text="Active" HorizontalAlignment="Center"/>
        <TextBlock Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Text="Name" HorizontalAlignment="Center"/>
        <telerik:RadListBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3"
                            ItemsSource="{Binding MIDIInPorts, Source={StaticResource InPortsViewModel}}"
                            ItemTemplate="{StaticResource InPortListTemplate}"
                            ItemContainerStyle="{StaticResource DraggableListBoxItem}"
                            HorizontalAlignment="Stretch"
                            Height="Auto">
        <telerik:RadListBox.DragDropBehavior>
                <telerik:ListBoxDragDropBehavior AllowReorder="True" />
            </telerik:RadListBox.DragDropBehavior>
            <telerik:RadListBox.DragVisualProvider>
                <!--<telerik:ScreenshotDragVisualProvider />-->
                <telerik:ListBoxDragVisualProvider/>
            </telerik:RadListBox.DragVisualProvider>
        </telerik:RadListBox>
        <StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Center">
            <TextBlock Text="{Binding MIDIInPortCount, Source={StaticResource InPortsViewModel}}" Margin="0,0,5,0"/>
            <TextBlock Text="Ports" />
        </StackPanel>
    </Grid>
</UserControl>

 

I had been trying to put the ContextMenu in the ListBoxItem template, but was having no luck, when I ran across a forum post somewere that suggested putting it in its style instead, and that's what we have here.  You'll find it right about in the middle of the code - just a single MenuItem, "Restore port name".  If I remove the MenuItem altogether, the app runs fine and when I right click on the ListBoxItem, an empty context menu pops up.  If I add the MenuItem with no Click property, the context menu pops up and shows the menu item.  Add the Click property definition and, boom!  Exception thrown.

I'm attaching some pictures that include what the list box looks like and the exception warning and details.

I wanted to use the RadContextMenu, but the app wouldn't build because it only allows ContexMenu at that point.  (Different exception)

Any suggestions as to what I might do to get it working?

Thanks,

Ken

Dilyan Traykov
Telerik team
 answered on 08 May 2019
1 answer
117 views
I want the user to be able to resize my window but only from the bottom or right.I tried CanMove=False but it doesn't help. Is there any way to get a notification before the resize and prevent it from happening if it is from one of those edges?
Dilyan Traykov
Telerik team
 answered on 07 May 2019
1 answer
86 views

I did some searching around but couldn't find anything about this, and I surprised it hasn't come up. I have several hotkeys using input bindings, which include "Alt" modifiers. They input bindings do work and run the command they are supposed to, but the access keys also come up. Is there a way I can prevent the ribbon from showing the access text when I also have an input binding which handles it?

In Excel, for example, you can press Alt+ to do auto sum, and it doesn't show the access text, so it's not like this is how the ribbons are supposed to work.

Vladimir Stoyanov
Telerik team
 answered on 07 May 2019
0 answers
84 views

Hi, I use your viewing schedule, but I'm confronted with this problem when more than 500-1000 appointments are assigned to the "month" of the navigation header, the slots on certain days are empty, although there are tasks these days.

Could there be a certain limit on the number of appointments?

Thank you for your support!

Yevhenii
Top achievements
Rank 1
 asked on 07 May 2019
3 answers
262 views

I'm using the following code (taken from WPF demos and slightly adjusted for Prism, as suggested in the documentation). However, requesting a change to the region's content doesn't show anything.

I have also tried having a ContentControl inside RadTransitionControl.Content to no avail. It is unclear to me at this point whether this is an issue with NavigationView or RadTransitionControl

<telerik:RadNavigationView x:Name="navigationView"
                            Grid.Row="1"
                            ItemsSource="{Binding Items}"
                            SelectedIndex="0">
    <telerik:RadNavigationView.Content>
        <telerik:RadTransitionControl prism:RegionManager.RegionName="ContentRegion"
                                      Duration="0:0:0.4">
            <telerik:RadTransitionControl.Transition>
                <telerik:FadeTransition />
            </telerik:RadTransitionControl.Transition>
        </telerik:RadTransitionControl>
    </telerik:RadNavigationView.Content>
    <telerik:RadNavigationView.PaneFooter>
        <telerik:RadNavigationViewItem Content="Settings"
                                        Command="{x:Static common:NavigationViewSettingsCommands.OpenSettingsDialogCommand}"
                                        CommandParameter="{Binding ElementName=navigationView}"
                                        IconTemplate="{x:Null}">
            <telerik:RadNavigationViewItem.Icon>                       
                    <telerik:RadGlyph Glyph="" FontSize="20" />                       
            </telerik:RadNavigationViewItem.Icon>
        </telerik:RadNavigationViewItem>
    </telerik:RadNavigationView.PaneFooter>
</telerik:RadNavigationView>
Jesus
Top achievements
Rank 1
 answered on 04 May 2019
1 answer
772 views

Hi,

I'm trying to find a way to set the GridViewColumn Visibility to Hidden when IsVisible = False. The default "IsVisible=False" behaviour is Collapsed.

Thanks

Dinko | Tech Support Engineer
Telerik team
 answered on 03 May 2019
5 answers
131 views

Hello

I'm using the radgridview and would like to animate the opening and closing of the rowdetails. How do I make it similar to the animation of the expander (without specifying a height).

I'm using version 19.1.220 with the material theme.

 

Thanks

Martin Ivanov
Telerik team
 answered on 02 May 2019
7 answers
689 views
The error I'm havnig is that the RadViewer will not fit the container that it sits in.  This is going off the assumption that the ScaleMode="FitToPage" fits the parents containers width and height.  Currently the pdf is not fitting to the parent window or even if I set the width and height of the RadPdfViewer itself it still seems to try to display it with no scaling applied.  Attached is how it currently looks.

<Window x:Class="Views.Dialogs.TelerikPdfDialog"
        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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        WindowStartupLocation="CenterOwner"
        ShowInTaskbar="False"
        AllowsTransparency="False"
        ResizeMode="NoResize"
        WindowStyle="None"
        mc:Ignorable="d"
        Title="TelerikPdfDialog" MaxWidth="800" MaxHeight="1000">
    



        <Window.Resources>

            <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../Resources/Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
        </Window.Resources>


        <Border BorderBrush="Black" BorderThickness="10">
            <Grid Background="{StaticResource gsiBackgroundBrush}" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                
                <Grid Grid.Row="0">
                    <Label HorizontalContentAlignment="Center" Margin="10" FontSize="38" Content="Hearing Test Results"/>
                </Grid>
            <ContentControl Grid.Row="1" x:Name="contentView" Height="350" Width="700" Background="Blue">

                <telerik:RadPdfViewer x:Name="pdfViewer"  ScaleMode="FitToPage" DocumentSource="{Binding PatientPdfPath}"/>

            </ContentControl>

            <Grid Grid.Row="2">
                <Grid VerticalAlignment="Bottom" Margin="0 10">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="2*" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <DockPanel Grid.Column="1"  >
                            <Button HorizontalAlignment="Left" Content="Print" Height="35" Width="85"/>
                            <Button Click="Click_Close"   HorizontalAlignment="Right" Content="Cancel" Height="35" Width="85" />
                        </DockPanel>

                    </Grid>
                </Grid>

            </Grid>
        </Border>

</Window>
Tanya
Telerik team
 answered on 02 May 2019
1 answer
396 views

It is causing a lot of issues for us that the row stays in edit mode if you click out from one cell into another. I would like to disable this but everything I have tried either doesn't work, or the cell flashes up into edit mode before the editor goes away.

 

For example, if I handle the CurrentCellChanged and either commit or cancel the edit, it just goes back into edit mode anyway. I can use BeginInvoke which kind of work but causes some other issues for me down the line.

Vladimir Stoyanov
Telerik team
 answered on 30 Apr 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?