Telerik Forums
UI for WPF Forum
1 answer
97 views

Hi there,

We have identified a bug with the RadPane/RadDocking control's maximize functionality, which we would appreciate your feedback on as soon as possible.

When maximizing a floating RadPane on a secondary display that has a resolution greater (1920*1200) than that of the primary display (1600*1200) the RadPane is not sized to the extent of the display, but extends beyond it.  This is only the case when the resolutions of the displays are setup in this way; if the primary screen has the greater resolution it does not occur.  Unfortunately this is a usual setup for laptop users who have a large display available when they are working in the office.

 

However, we have resolved this issue (or very similar) in the past in some of our own window management code, so may be able to offer a potential resolution.  We experienced the same symptoms in our custom windows as a result of using a WindowStyle of None and then using Win32 interop to set the minmaxinfo appropriately to avoid overlapping the Windows TaskBar.  The calculations for some reason became invalid in the scenario described above.  The solution implemented was simply not to adjust the minmaxinfo when the window was found to be not on the primary screen.

 

Looking forward to your feedback,

Chris


George
Telerik team
 answered on 15 May 2012
4 answers
176 views
I have a StackPanel within a GridView with its InputBindings set to LeftDoubleClick as shown below.

<TelerikGW:RadGridView x:Name="radGridView" Grid.Row="2"
ItemsSource="{Binding SearchResult.Results}"
ScrollViewer.HorizontalScrollBarVisibility="Visible"
MinWidth="50"
HorizontalAlignment="Stretch"
>
<TelerikGW:RadGridView.Columns>
<TelerikGW:GridViewDataColumn Width="*" MinWidth="50">
<TelerikGW:GridViewDataColumn.Header>
<Label Content="Found" />
</TelerikGW:GridViewDataColumn.Header>
<TelerikGW:GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Margin="0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Orientation="Horizontal"
>
<StackPanel.InputBindings>
<MouseBinding Command="{Binding Path=ResultClick}" MouseAction="LeftDoubleClick" />
</StackPanel.InputBindings>
<Image Height="20"
MaxWidth="100"
Margin="0"
Source="{Binding ClassIcon.ContentBytes}"
Stretch="Uniform" />
<WV:TextHighLighter Margin="10"
ToolTip="{Binding ResultItem.MatchTerm}"
Padding="0"
Text="{Binding Path=ResultItem.MatchTerm}"
TextToHighLight="{Binding DataContext.SearchedTerm, RelativeSource={RelativeSource AncestorType=WV:GlobalSearch}}" />
</StackPanel>
</DataTemplate>
</TelerikGW:GridViewColumn.CellTemplate>
</TelerikGW:GridViewDataColumn>
</TelerikGW:RadGridView.Columns>
</TelerikGW:RadGridView>


At runtime, on double cicking it throws the following exception.

[System.InvalidCastException] = {"Unable to cast object of type 'System.Windows.Documents.Run' to type 'System.Windows.FrameworkElement'."}
 
Message = "Unable to cast object of type 'System.Windows.Documents.Run' to type 'System.Windows.FrameworkElement'."
 
Source = "Telerik.Windows.Controls.GridView"
 
StackTrace = "   at Telerik.Windows.Controls.GridView.GridViewRow.ShouldHandleMouseDoubleClick(MouseButtonEventArgs e)\r\n   at Telerik.Windows.Controls.GridView.GridViewRow.OnMouseDoubleClick(MouseButtonEventArgs e)\r\n   at System.Windows.Controls.Control.HandleDouble...

It works if the MouseAction is set to LeftClick, which I don't want to use.

It had worked with 2011-Q3.

Can someone get back with a solution for this please?

Best Regards,

Gajan





Vlad
Telerik team
 answered on 15 May 2012
0 answers
77 views
Sir,
 I am having a gridview with gridviewselectedcolumn. And have set mode of gridview as multiple.
Now I want to use a for loop to check which rows are selected how is it possible because there is no such proerty to check for eg radgridview.Items(0).IsSelected=True can u pls give me the alternative code.

Thanks & Regards,
Utkarsh Ashtekar
Utkarsh
Top achievements
Rank 1
 asked on 15 May 2012
1 answer
124 views
Good evening,

This may be a bit of a noob question but how does one interact with RadDocumentPane from a main window?

Let me detail my Situation.

My main window contains a RadDockingControl. The RadDockingControl has an area for a DocumentHost.
<telerikDocking:RadDocking.DocumentHost>
    <telerikDocking:RadSplitContainer>
        <telerikDocking:RadPaneGroup x:Name="radDockingDocumentHost" />
    </telerikDocking:RadSplitContainer>
</telerikDocking:RadDocking.DocumentHost>

In Code Behind I programmatically add RadDocumentPanes to the DocumentHost whenever a button is pressed.
private void btnBlankNewOrder_Click(object sender, RoutedEventArgs e)
{
    //ADD NEW DOCUMENT PANE _ RadRichTextBox
    var pane = new RadRichTextBoxAutoComplete(products);
    pane.Title = "Rob's Test Pane";
    radDockingDocumentHost.Items.Add(pane);
}

The RadDocumentPanes being added are a modified UseControl which now inherits the RadDocumentPane.
<telerik:RadDocumentPane x:Class="TAS2.RadRichTextBoxAutoComplete"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerikDocking="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"
             xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             mc:Ignorable="d">
 
.................MY CONTROL CONTENT HERE (Cut Out for this Example) ...................
 
</telerik:RadDocumentPane>

Each RadDocumentPane hosts a Grid (actually there are nested Grids which have been cut out for this example) that contain a RadRichTextBox.
<telerik:RadDocumentPane x:Class="TAS2.RadRichTextBoxAutoComplete" ..... >
          <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                 
                <!-- RichTextBox -->
                <telerik:RadRichTextBox x:Name="radRichTextBox" AcceptsReturn="True" Width="800" Margin="10" Padding="10" Grid.Column="0"
                                        FontSize="14" IsSpellCheckingEnabled="False" DocumentInheritsDefaultStyleSettings="True" />
          </Grid>
</telerik:RadDocumentPane>

Going back to my Main Window that contains the main RadDocking control, I have a Ribbon menu containing several buttons (see the attached image).

How do I interact with the programatically added RadDocumentPanes and their respective RichTextBox's when pressing a button in the Ribbon menu?

For example, suppose that the ribbon bar contains a "Paste" button. How do I make the "Paste" command associate itself with the RichTextBox of the current DocumentPane in view?

I would attach samples of my code but it won't let me add them, only images.

Thank you for your time,

All help is appreciated.
Robert
Top achievements
Rank 1
 answered on 15 May 2012
6 answers
208 views

Hello,

I am using Telerik version 2012.1.326
I have a RadGridView, and I am using the ToExcelML() method provided (see code below). The problem is that all of the data is converted into strings by the method. The data comes out of a datatable as strings, decimals, and datetimes. And it is shown in the grid view as it's given datatype. You can filter the columns, and the filter also respects datatype. How do I keep the data as it's original datatype when it is exported?

Thank you,
Eli


            SaveFileDialog dialog = new SaveFileDialog();
            string extension = "xml";
            dialog.InitialDirectory = Settings.Default.DataSavePath;
            dialog.DefaultExt = extension;
            dialog.Filter = string.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "ExcelML");
            dialog.FilterIndex = 1;

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var gridOutput = this.radGridView.ToExcelML().Replace("Worksheet1", "Output");

                using (Stream stream = dialog.OpenFile())
                {
                    byte[] bytes = Encoding.UTF8.GetBytes(gridOutput);
                    stream.Write(bytes, 0, bytes.Length);
                }

Eli
Top achievements
Rank 1
 answered on 14 May 2012
1 answer
379 views
I've implemented a small sample using the RadPdfViewer control.

Here's the key part of the MainWindow xaml:
<telerik:RadPdfViewer x:Name="pdfViewer" Margin="144,41,0,0" />

And here's the code that loads one of the three test documents in MainWindow.xaml.cs:
            this.pdfViewer.DocumentSource = new PdfDocumentSource( 
                File.OpenRead( @"..\..\documents\LudwigVonMises.pdf" ), FormatProviderSettings.ReadAllAtOnce );

When it displays, the document is missing the title image (which appears in other readers like Foxit and Acrobat).
It also has odd text kerning issues, such as excess spaces or letters over-running each other.

On another document, it renders the title image but it's distorted.

I've attached a sample of the poorly-rendered text.

Are there other settings I can exploit to correct these issues?
Kammen
Telerik team
 answered on 14 May 2012
2 answers
176 views
I'm testing out the RadGridView as a replacement for the standard wpf gridview I had been using.  I've got a complex row styleselector class which builds a style dynamically based on multiple criteria. I find that using the RadGridView I am no longer able to access the ItemsControl using ItemsControl.ItemsControlFromItemContainer(container) from within this class as it returns null.  I was using ItemsControl to determine is this was the first row in the collection.  Is there another alternative for identifying the first row in the collection from a styleselector?
Vic
Top achievements
Rank 1
Iron
 answered on 14 May 2012
3 answers
225 views
I am using WPF PDF Viewer (the latest version) - there is a certain PDF document I can't load. Its a large document with > 300 pages saved as PDF version 1.5 with a free PDF tool. Other (smaller) PDF docs are displayed just fine.

Could be PDF format the reason? Or can't WPF PDF Viewer handle large documents?

Kind regards,

Victor
Kammen
Telerik team
 answered on 14 May 2012
1 answer
552 views
Well yet again, I pull down the latest WPF build and find my past troubles resolved, but new ones prevail. 

OK, down to the point.  The RadGridView is buggie due to a check in the RadWatermarkTextBox.  I don't know why, but when I override a columns template and specify TextBlock elements that use Hyperlink(s), this function fails because it assumes all focusedElements are of type Visual (which Hyperlink(s) are not).  In case your wondering why im so critical here, it is because I'm constantly finding bugs.  Go figure!

Telerik's Code
private bool GetIsFocused()
{
    var focusedElement = FocusManagerHelper.GetFocusedElement(this);
    if (focusedElement != null) {
        return focusedElement == this || this.IsAncestorOf((DependencyObject)focusedElement);
    }
    return false;
}

My improvement:
private bool GetIsFocused()
{
    var focusedElement = FocusManagerHelper.GetFocusedElement(this);
    if (focusedElement != null && focusedElement is DependencyObject) {
        var focusedAsDependencyObject = (DependencyObject)focusedElement;
        if (focusedAsDependencyObject is System.Windows.Media.Visual)
            return focusedAsDependencyObject == this || this.IsAncestorOf(focusedAsDependencyObject);
        else if (focusedAsDependencyObject is FrameworkContentElement) {
            var parentVisual = ((FrameworkContentElement)focusedAsDependencyObject).Parent as System.Windows.Media.Visual;
            return focusedAsDependencyObject == this || (parentVisual != null && this.IsAncestorOf(parentVisual));
        }
    }
    return false;
}
Yana
Telerik team
 answered on 14 May 2012
4 answers
136 views
Hello,
I'm trying to modify the GridViewHeaderCell style with a trigger on the Tag property  :
<Style  TargetType="{x:Type telerik:GridViewHeaderCell}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type telerik:GridViewHeaderCell}">
                            <Grid x:Name="PART_HeaderCellGrid">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Border x:Name="GridViewHeaderCell" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2">
                                    <Border BorderBrush="#FF4B4B4B" BorderThickness="0" Background="{TemplateBinding Background}"/>
                                </Border>
                                <Border x:Name="GridViewHeaderCell_Over" BorderBrush="#FFFFC92B" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" Opacity="0">
                                    <Border BorderBrush="White" BorderThickness="0">
                                        <Border.Background>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FFFFFBA3" Offset="1"/>
                                                <GradientStop Color="#FFFFFBDA" Offset="0"/>
                                                <GradientStop Color="#FFFFD25A" Offset="0.43"/>
                                                <GradientStop Color="#FFFEEBAE" Offset="0.42"/>
                                            </LinearGradientBrush>
                                        </Border.Background>
                                    </Border>
                                </Border>
                                <Border x:Name="GridViewHeaderCell_Selected" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" Opacity="0">
                                    <Border.BorderBrush>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FF616161" Offset="0"/>
                                            <GradientStop Color="#FF989898" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Border.BorderBrush>
                                    <Border BorderThickness="0">
                                        <Border.BorderBrush>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FFB69A78"/>
                                                <GradientStop Color="#FFFFE17A" Offset="0.126"/>
                                            </LinearGradientBrush>
                                        </Border.BorderBrush>
                                        <Border.Background>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FFFFD74E" Offset="0.996"/>
                                                <GradientStop Color="#FFFFDCAB" Offset="0.17"/>
                                                <GradientStop Color="#FFFFB062" Offset="0.57"/>
                                                <GradientStop Color="#FFFFD18F" Offset="0.56"/>
                                                <GradientStop Color="#FFFFBA74"/>
                                            </LinearGradientBrush>
                                        </Border.Background>
                                    </Border>
                                </Border>
                                <ContentControl x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsTabStop="{TemplateBinding IsTabStop}" Margin="0,0,10,0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                    <ContentControl.Style>
                                        <Style TargetType="{x:Type ContentControl}">
                                            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                                            <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                                        </Style>
                                    </ContentControl.Style>
                                </ContentControl>
                                <Path x:Name="PART_SortIndicator" Grid.ColumnSpan="2" Data="M0,0L1,0 2,0 3,0 4,0 5,0 5,1 4,1 4,2 3,2 3,3 2,3 2,2 1,2 1,1 0,1 0,0z" Fill="Black" HorizontalAlignment="Center" Height="3" Margin="0,3,0,0" Opacity="0" RenderTransformOrigin="0.5,0.5" Stretch="Fill" VerticalAlignment="Top" Width="5">
                                    <Path.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform ScaleY="-1" ScaleX="1"/>
                                            <SkewTransform AngleY="0" AngleX="0"/>
                                            <RotateTransform Angle="0"/>
                                            <TranslateTransform X="0" Y="0"/>
                                        </TransformGroup>
                                    </Path.RenderTransform>
                                </Path>
                                <telerik:FilteringDropDown x:Name="PART_DistinctFilterControl" Grid.Column="1" IsTabStop="False" Margin="0,0,8,0" Visibility="{TemplateBinding FilteringUIVisibility}">
                                    <telerik:StyleManager.Theme>
                                        <telerik:Office_BlackTheme/>
                                    </telerik:StyleManager.Theme>
                                </telerik:FilteringDropDown>
 
                                <Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" Grid.ColumnSpan="2">
                                    <Thumb.Style>
                                        <Style TargetType="{x:Type Thumb}">
                                            <Setter Property="Width" Value="8"/>
                                            <Setter Property="Background" Value="Transparent"/>
                                            <Setter Property="BorderBrush" Value="Transparent"/>
                                            <Setter Property="BorderThickness" Value="0"/>
                                            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                                            <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                                            <Setter Property="Padding" Value="0,3,0,4"/>
                                            <Setter Property="Margin" Value="15,0,0,0"/>
                                            <Setter Property="Cursor" Value="SizeWE"/>
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="{x:Type Thumb}">
                                                        <Border HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                                            <DockPanel HorizontalAlignment="Center">
                                                                <Rectangle Fill="#FFC7C5B2" Width="1"/>
                                                                <Rectangle Fill="White" Width="1"/>
                                                            </DockPanel>
                                                        </Border>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </Thumb.Style>
                                </Thumb>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsMouseOver" Value="True"/>
                                        <Condition Property="SortingState" Value="None"/>
                                    </MultiTrigger.Conditions>
                                    <MultiTrigger.EnterActions>
                                        <BeginStoryboard>
                                            <Storyboard>
                                                <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="GridViewHeaderCell_Over">
                                                    <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1"/>
                                                </DoubleAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </BeginStoryboard>
                                    </MultiTrigger.EnterActions>
                                    <MultiTrigger.ExitActions>
                                        <BeginStoryboard>
                                            <Storyboard>
                                                <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="GridViewHeaderCell_Over">
                                                    <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
                                                </DoubleAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </BeginStoryboard>
                                    </MultiTrigger.ExitActions>
                                    <Setter Property="Foreground" Value="Black"/>
                                </MultiTrigger>
                                <Trigger Property="SortingState" Value="Ascending">
                                    <Setter Property="Foreground" Value="Black"/>
                                    <Setter Property="Opacity" TargetName="PART_SortIndicator" Value="1"/>
                                    <Setter Property="LayoutTransform" TargetName="PART_SortIndicator">
                                        <Setter.Value>
                                            <ScaleTransform ScaleY="1" ScaleX="1"/>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Opacity" TargetName="GridViewHeaderCell_Selected" Value="1"/>
                                </Trigger>
                                <Trigger Property="SortingState" Value="Descending">
                                    <Setter Property="Foreground" Value="Black"/>
                                    <Setter Property="Opacity" TargetName="PART_SortIndicator" Value="1"/>
                                    <Setter Property="LayoutTransform" TargetName="PART_SortIndicator">
                                        <Setter.Value>
                                            <ScaleTransform ScaleY="-1" ScaleX="1"/>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Opacity" TargetName="GridViewHeaderCell_Selected" Value="1"/>
                                </Trigger>
                                <Trigger Property="SortingState" Value="None">
                                    <Setter Property="Opacity" TargetName="PART_SortIndicator" Value="0"/>
                                </Trigger>
 
                                <Trigger Property="Tag">
                                    <Trigger.Value>
                                        <sys:Boolean>True</sys:Boolean>
                                    </Trigger.Value>
                                    <Setter Property="Background" Value="Red"/>
                                </Trigger>
                                 
                                <Trigger Property="Tag">
                                    <Trigger.Value>
                                        <sys:Boolean>False</sys:Boolean>
                                    </Trigger.Value>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Background" >
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FFE2E2E2" Offset="1"/>
                            <GradientStop Color="#FFE8E8E8"/>
                            <GradientStop Color="#FFCECBCB" Offset="0.42"/>
                            <GradientStop Color="#FFC4C4C4" Offset="0.43"/>
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="Padding" Value="5,0,3,0"/>
                <Setter Property="Foreground" Value="Black"/>
                <Setter Property="FilteringUIVisibility" Value="Collapsed"/>
            </Style>

When I'm setting "true" on the first column :
this.gvObjGECO.ChildrenOfType<GridViewHeaderCell>().FirstOrDefault().Tag = true;

It's working well but when I'm moving the horizontal scrollbar, other column headers are changing their style too.
How can I stop this behaviour?

Here is a Sample I made with the latest telerik version
sven
Top achievements
Rank 1
 answered on 14 May 2012
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?