Telerik Forums
UI for WPF Forum
2 answers
298 views
For a proof of concept linked to my question described here (see my last post) I have begun experimenting with modifying a deserialized RadDocument prior to assigning it to the control. The idea behind this is to store links to external resources using the standard HyperlinkRangeStart-HyperLink-HyperlinkRangeStop concept and transforming those hyperlinks into custom controls hosted in InlineUIContainer objects.To test if this can work I've tried the following:

var doc = provider.Import(xml);

var hyperLinks = doc.EnumerateChildrenOfType<HyperlinkRangeStart>();
foreach (var link in hyperLinks)
{
var parent = link.Parent;
parent.Children.Remove(link);

InlineUIContainer container = new InlineUIContainer(new Button(), new Size(400, 300));
parent.Children.Add(container);
}

doc.History.Clear();

// BOOOM
doc.UpdateLayout();

This will crash in UpdateLayout or when I assign the document to a RadRichTextBox with the following exception:

InvalidOperationException "Stack Empty"

"   at System.Collections.Generic.Stack`1.Pop()\r\n   at Telerik.Windows.Documents.Layout.LayoutBox.UpdateFieldProperties(DocumentElement element, Stack`1 fieldStartsStack) in c:\\TB\\101\\WPF_Scrum\\Release_WPF_40\\Sources\\Development\\Documents\\Layout\\LayoutBox.cs:line 541\r\n   at Telerik.Windows.Documents.Layout.LayoutBox.UpdateFieldProperties(DocumentElement element, Stack`1 fieldStartsStack) in c:\\TB\\101\\WPF_Scrum\\Release_WPF_40\\Sources\\Development\\Documents\\Layout\\LayoutBox.cs:line 524\r\n   at Telerik.Windows.Documents.Layout.LayoutBox.UpdateFieldProperties(DocumentElement element, Stack`1 fieldStartsStack) in c:\\TB\\101\\WPF_Scrum\\Release_WPF_40\\Sources\\Development\\Documents\\Layout\\LayoutBox.cs:line 524\r\n   at Telerik.Windows.Documents.Layout.LayoutBox.UpdateFieldProperties(DocumentElement element) in c:\\TB\\101\\WPF_Scrum\\Release_WPF_40\\Sources\\Development\\Documents\\Layout\\LayoutBox.cs:line 520\r\n   at Telerik.Windows.Documents.Layout.DocumentLayoutBox.UpdateGlobalProperties() in c:\\TB\\101\\WPF_Scrum\\Release_WPF_40\\Sources\\Development\\Documents\\Layout\\DocumentLayoutBox.cs:line 276\r\n   at Telerik.Windows.Documents.Layout.DocumentLayoutBox.MeasureOverride(SizeF availableSize) in c:\\TB\\101\\WPF_Scrum\\Release_WPF_40\\Sources\\Development\\Documents\\Layout\\DocumentLayoutBox.cs:line 259\r\n   at Telerik.Windows.Documents.Layout.LayoutElement.MeasureCore(SizeF availableSize) in c:\\TB\\101\\WPF_Scrum\\Release_WPF_40\\Sources\\Development\\Documents\\Layout\\LayoutElement.cs:line 1473\r\n   at Telerik.Windows.Documents.Layout.LayoutElement.Measure(SizeF availableSize) in c:\\TB\\101\\WPF_Scrum\\Release_WPF_40\\Sources\\Development\\Documents\\Layout\\LayoutElement.cs:line 1352\r\n   at Telerik.Windows.Documents.Layout.ContextLayoutManager.UpdateLayout() in c:\\TB\\101\\WPF_Scrum\\Release_WPF_40\\Sources\\Development\\Documents\\Layout\\ContextLayoutManager.cs:line 360\r\n   at Telerik.Windows.Documents.Layout.LayoutElement.UpdateLayout() in c:\\TB\\101\\WPF_Scrum\\Release_WPF_40\\Sources\\Development\\Documents\\Layout\\LayoutElement.cs:line 982\r\n   at Telerik.Windows.Documents.Model.RadDocument.UpdateLayout() in c:\\TB\\101\\WPF_Scrum\\Release_WPF_40\\Sources\\Development\\Documents\\Model\\RadDocument.cs:line 706\r\n   at Mindspace.DocumentEditors.RichTextDocumentEditor.<SetEditorContent>b__3() in C:\\Users\\oliver\\Projects\\Mindspace\\SilverlightClient\\DocumentEditors\\RichTextDocumentEditor.cs:line 296"
Iva Toteva
Telerik team
 answered on 14 Jul 2011
5 answers
178 views
Hi, I am working on an application based on RadTileView, similar to the 'Example' that Telerik provides in

http://www.telerik.com/help/wpf/radtileview-howto-use-fluidcontentcontrol-in-tileview.html

My problem is that raises an exception when TileState property has to be bound through 'tileStateConverter'. If I change the value to Maximized, Minimized o Restored does not crash. The exception is a XamlParseException: A error raises when setting the property ''. (More or less cause the text is displayed to me in Spanish).

Here is the xaml file:
<UserControl.Resources>
         
        <local:FluidContentStateConverter x:Key="fluidContentStateConverter" />
        <local:TileStateConverter x:Key="tileStateConverter" />
         
            <!--HeaderedContentControl Resources-->
        <SolidColorBrush x:Key="Pad_BorderBrush" Color="#FF242699"/>
        <SolidColorBrush x:Key="Pad_Background" Color="#FFFFFF"/>
        <SolidColorBrush x:Key="Pad_Header_Background" Color="#FF242699"/>
        <Style x:Key="DefaultHeaderedContentControlStyle" TargetType="telerik:HeaderedContentControl">
            <Setter Property="BorderThickness" Value="1 0 1 1"/>
            <Setter Property="BorderBrush" Value="{StaticResource Pad_BorderBrush}"/>
            <Setter Property="Background" Value="{StaticResource Pad_Background}"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="FontWeight" Value="Bold"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="telerik:HeaderedContentControl">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Border Background="{StaticResource Pad_Header_Background}" CornerRadius="4 4 0 0" Padding="10 7" Grid.Row="0">
                                <ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}"/>
                            </Border>
                            <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0 0 4 4" Grid.Row="1">
                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
 
        <DataTemplate x:Key="ItemTemplate">
            <TextBox Text="{Binding Login}" />
        </DataTemplate>
 
        <!-- RadTileView -->
        <DataTemplate x:Key="ContentTemplate">
            <telerik:RadFluidContentControl ContentChangeMode="Manual" State="{Binding ContentState, Converter={StaticResource fluidContentStateConverter}}">
                <telerik:RadFluidContentControl.SmallContent>
                    <TextBlock Text="Peque"></TextBlock>
                </telerik:RadFluidContentControl.SmallContent>
                <telerik:RadFluidContentControl.Content>
                    <TextBlock Text="Normal"></TextBlock>
                </telerik:RadFluidContentControl.Content>
                <telerik:RadFluidContentControl.LargeContent>
                    <TextBlock Text="Big"></TextBlock>
                </telerik:RadFluidContentControl.LargeContent>
            </telerik:RadFluidContentControl>
        </DataTemplate>
 
        <Style x:Key="ItemContainerStyle" TargetType="telerik:RadTileViewItem">
            <Setter Property="TileState" Value="{Binding ContentState, Mode=TwoWay, Converter={StaticResource tileStateConverter}}" />
        </Style>
         
    </UserControl.Resources>
 
    <Grid x:Name="LayoutRoot" Background="{StaticResource FondoMalva}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="150" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <telerik:HeaderedContentControl Height="300" HorizontalAlignment="Center" Width="Auto"  VerticalAlignment="Center" Name="HeaderedControlUsers" Style="{StaticResource DefaultHeaderedContentControlStyle}"
         Header="Users">
            <telerik:RadTileView Name="RadTileViewUsers"
                                 ContentTemplate="{StaticResource ContentTemplate}"
                                 ItemContainerStyle="{StaticResource ItemContainerStyle}"
                                 ItemTemplate="{StaticResource ItemTemplate}"
                                 MinimizedColumnWidth="200"
                                 MinimizedItemsPosition="Right"
                                 MinimizedRowHeight="200"/>
        </telerik:HeaderedContentControl>

And here the converter for TileState property:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using Telerik.Windows.Controls;
 
namespace NCOP_Mgt
{
    public class TileStateConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var contentState = (ContentState)value;
            switch (contentState)
            {
                case ContentState.SmallContent:
                    return TileViewItemState.Minimized;
                case ContentState.NormalContent:
                    return TileViewItemState.Restored;
                case ContentState.LargeContent:
                    return TileViewItemState.Maximized;
                default:
                    return TileViewItemState.Restored;
            }
        }
 
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var tileState = (TileViewItemState)value;
            switch (tileState)
            {
                case TileViewItemState.Minimized:
                    return ContentState.SmallContent;
                case TileViewItemState.Restored:
                    return ContentState.NormalContent;
                case TileViewItemState.Maximized:
                    return ContentState.LargeContent;
                default:
                    return ContentState.NormalContent;
            }
        }
    }
}

I do know what is happening because for FluidContentStateConverter and its conversion seems is fine..
Thank so much (in advance).

Eduardo
Eduardo
Top achievements
Rank 1
 answered on 14 Jul 2011
5 answers
168 views
I have used the example to drag windows explorer files by enabling the EnableNativeDrag option. I added my DropQuery and DropInfo handlers and they seem to be firing fine but the status is always DragPossible. I am dragging a file from my desktop to a ListView with a GridView, GridViewColumns and CellTemplates defined. I have allowed drop on both the ListView and ListViewItems and nothing seems to allow the status to change to DropComplete. Help!

RadDragAndDropManager.SetAllowDrop(theListView, true);
                    RadDragAndDropManager.AddDropQueryHandler(theListView, OnAttachmentsDropQuery);
                    RadDragAndDropManager.AddDropInfoHandler(theListView, OnAttachmentsDropInfo);

protected virtual void OnAttachmentsDropInfo(object sender, DragDropEventArgs e)
        {
            if (e.Options.Status == DragStatus.DropComplete)
            {               
                StringCollection fileList = e.Options.DropDataObject.GetFileDropList();
                foreach (string file in fileList)
                {
                    //Take only the file name.
                    string fileName = file.Substring(file.LastIndexOf(System.IO.Path.DirectorySeparatorChar) + 1, file.Length - file.LastIndexOf(System.IO.Path.DirectorySeparatorChar) - 1);                }
            }
        }
 
        private void OnAttachmentsDropQuery(object sender, DragDropQueryEventArgs e)
        {
            e.QueryResult = e.Options.DropDataObject != null && e.Options.DropDataObject.ContainsFileDropList();
        }

Rod Yager
Tina Stancheva
Telerik team
 answered on 14 Jul 2011
2 answers
70 views
Hi, 

sometimes, when paging fast through the items in the RadCarousel, the pages seem to have the wrong order: The topmost page is overlaped by a page that is further in the background. This behaviour is best reproducible by paging with the mouse wheel forward and backward fast.
I can reproduce this even in the "First Look" example in the Telerik WPF Demos(Q1/2011).

I've looked at the Z-order of the items: it's not correct.

Is there a way to get around this?

Greetings, 
   J.S.
Yordanka
Telerik team
 answered on 14 Jul 2011
3 answers
119 views
I have a hierarchy of items and when I double click one item I asynchronously open the document represented by that item in a working area. During the (potentially) long open action I disable that item so the user can't double click it again, or rename it or delete it etc.

However I've seen that its children also get disabled by this and I don't want this.

Can I just disable one item without having its children disabled?
Petar Mladenov
Telerik team
 answered on 14 Jul 2011
1 answer
183 views
Using WPF4's TextOptions.TextFormattingMode="Display" to improve overall text clarity seems introduce rendering artifacts with the RadRichTextBox as shown in the screenshot. Since in my opinion TextOptions.TextFormattingMode="Display" greatly improves the overall impression of a WPF app it would be nice if the RadRichTextBox would handle this correctly.

http://www.flickr.com/photos/47457340@N06/5914179061/

Boby
Telerik team
 answered on 14 Jul 2011
0 answers
141 views
Hi Team,

We are using telerik rad gridview (Version 2011.1.0419)  in application. It is working very fine. The problem that we are facing is, the columns of gridview are getting collapsed(to very narrow) for few seconds while loading data into it, later the columns widths are adjusting automatically.

Requirement is When the scrollable grid is first displayed, the columns should be displayed in their final form without the collapsing and expanding of columns.

Please let us know what is the resolution for this. I am placing xaml code that we have used.

Also, Please let us know how to display the grid only after loading as a quick solution

<telerik:RadGridView Name="searchResultsGridView" ColumnWidth="*" CanUserDeleteRows="False" IsReadOnly="True" IsFilteringAllowed="False" CanUserSortColumns="True" CanUserInsertRows="False" VerticalAlignment="Top" RowLoaded="OnSearchResultsGridLoaded" SelectionChanged="OnSearchResultsSelectionChanged" RowUnloaded="OnSearchResultsGridUnLoaded"   Height="Auto" Width="Auto" Margin="5,3,5,0" Style="{StaticResource GridViewStyle}" HeaderRowStyle="{StaticResource HeaderStyle}" ItemsSource="{Binding}">
                                <telerik:RadGridView.Columns >
                                    <telerik:GridViewDataColumn Name="createDateCol" Width="Auto"  Header="Last Updated" DataMemberBinding="{Binding CreatedDate}" HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
                                    <telerik:GridViewDynamicHyperlinkColumn Name="lastNameCol" Width="Auto"  Header="Last Name" DataMemberBinding="{Binding LastName}"  HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
                                    <telerik:GridViewDynamicHyperlinkColumn Name="firstNameCol" Width="Auto" Header="First Name" DataMemberBinding="{Binding FirstName}" HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
                                    <telerik:GridViewDataColumn Name="dateOfBrthCol" Header="Age"  DataMemberBinding="{Binding DOB}" Width="Auto" HeaderTextAlignment="Center" TextAlignment="Center" HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
                                    <telerik:GridViewDataColumn Name="genderCol"    Header="G" DataMemberBinding="{Binding Gender}" Width="Auto" HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
                                    <telerik:GridViewDataColumn Name="stateCol"     Header="ST" DataMemberBinding="{Binding StateCode}" Width="Auto" HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
                                    <telerik:GridViewDataColumn Name="quoteIdCol"    Header="Quote/Illustration" Width="Auto" HeaderTextAlignment="Left" TextAlignment="Left" DataMemberBinding="{Binding QuoteId}"  HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
                                    <telerik:GridViewDynamicHyperlinkColumn Name="prodDescCol"  UniqueName="prodDescCol"   Header="Product Summary" DataMemberBinding="{Binding ProductDesc}" HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
                                    <telerik:GridViewDataColumn Name="annPremCol"   Header="Annual Premium" DataMemberBinding="{Binding AnnualPremium}" HeaderTextAlignment="Right" TextAlignment="Right" Width="Auto" HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
                                    <telerik:GridViewDataColumn Name="agntCdCol"    Header="Agent Code" DataMemberBinding="{Binding AgentCode}" HeaderTextAlignment="Right" TextAlignment="Right" Width="Auto" HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
                                    <telerik:GridViewDataColumn Name="agntNameCol" Width="Auto" Header="Agent Name" DataMemberBinding="{Binding AgentName}" HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
                                    <telerik:GridViewDataColumn Name="gaCodeCol"    Header="GA Code" DataMemberBinding="{Binding GACode}" Width="Auto" HeaderTextAlignment="Right" TextAlignment="Right" HeaderCellStyle="{StaticResource ColumnHeaderStyle}" CellStyle="{StaticResource gridcellStyle}"/>
                                </telerik:RadGridView.Columns>
                            </telerik:RadGridView>


Regards
Ramesh
Ramesh
Top achievements
Rank 1
 asked on 14 Jul 2011
1 answer
91 views
Hi,

I need to bind the tileviewItems count dynamically from xaml.
I mean same times i need to show only one item and some time up to 10 items.

Can you Please help me.....
i was gone through the wpf examples but i can't get  
SimpleItem.Generate(50);

what is    simpleItem there.
and also .generte property also.

Help me plzzzzzzzzz




thanks in advance...
Zarko
Telerik team
 answered on 13 Jul 2011
2 answers
113 views

Our testing team reported that on occasion column reordering by drag-and-drop resulted in other columns moving.  Since we do not implement any custom reordering or drag-and-drop functionality in the grid, I could not figure out why this was happening.  Therefore, I added event handlers for ColumnReordering and ColumnReordered.  What I discovered was that sometimes the events were being called multiple times for a single drag-drop operation on a column.  This was happening in a somewhat random pattern.  I could drag a column to a new position, and it would work ok with the events only called once, then I would drag another column, and three columns would move to new positions, with the event called for each move. 

Right now, we are using version 2011.1.419.40.  Are there any known issues with column reordering that were fixed?

Thanks for your help.
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
 answered on 13 Jul 2011
1 answer
141 views
Hello,
  I am trying to implement a filter to treeview items based on a textbox value used as a search string.  I figured I could evalute the FullPath property of a treeviewitem to insure all parent/children were included however the FullPath property seems to be coming across as Empty for me.  Is there something I am missing?  Here is my code:

 

Private Function NameFilter(ByVal item As RadTreeViewItem) As Boolean

    If item.HasItems Then item.Items.Filter = New Predicate(Of Object)(AddressOf NameFilter)

    Return item.FullPath.Contains(txtSearchList.Text)

End Function


Petar Mladenov
Telerik team
 answered on 13 Jul 2011
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
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
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
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?