Telerik Forums
UI for WPF Forum
3 answers
302 views

 

Greetings

Currently I'm not that experienced with styles in WPF and after some research I decided to give it a shot to ask. 

I'm working with with the RadGridView and I'd like to change the Foreground of the header of a sorted column. 

Within the styles of Telerik I found there are some visual states to determine the colour of the border or for the ascending/ descending arrow. Yet there is no description to change the colour of the Foreground. 

Yet doing some research, I found some code to add to change the Foreground as well within the VisualState. 

<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="(TextBlock.Foreground)">
    <DiscreteObjectKeyFrame KeyTime="0" Value="White" />
</ObjectAnimationUsingKeyFrames>

Yet, this isn't working. This entirely breaks the VisualState of 'Ascending'/ 'Descending' and the following exception within Output can be found:

A first chance exception of type 'System.InvalidOperationException' occurred in PresentationFramework.dll

Sorry for asking perhaps a dumb question. I'm still in the learning process of Telerik styles and WPF styles in general. 

Kind regards

Kenneth

Mark
Top achievements
Rank 1
 answered on 22 Jun 2016
3 answers
604 views
I have an editable RadGridView with set column widths.  When the user clicks a cell to edit its contents, the editing TextBox appears to be much more narrow than the width of its column.  How can I change this so that the TextBox stretches to the column width?

I tried using a template for the cell but this prevented the cell/row validation from working:
<DataTemplate x:Name="editCellTemplate">
    <Grid>
        <TextBox MaxLength="100" Margin="5,3"
                 Width="{Binding ActualWidth,
                            RelativeSource={RelativeSource
                               Mode=FindAncestor,
                               AncestorType={x:Type telerik:GridViewCell}}}"
                 Text="{Binding Label, Mode=TwoWay}" />
    </Grid>
</DataTemplate>
 
<telerik:RadGridView Margin="10" MinHeight="300" RowHeight="30"
              HorizontalAlignment="Left" VerticalAlignment="Top"
              AutoGenerateColumns="False" IsFilteringAllowed="False"
              CanUserInsertRows="True" CanUserDeleteRows="False"
              CanUserFreezeColumns="False" CanUserReorderColumns="False"
              ShowGroupPanel="False" ShowInsertRow="True"
              ItemsSource="{Binding SourceView, Mode=OneWay}">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn x:Name="Label" Header="Label" Width="300"
                           DataMemberBinding="{Binding Label, Mode=TwoWay}"
                           CellEditTemplate="editCellTemplate" />
        <telerik:GridViewCheckBoxColumn x:Name="Inactive" Header="Inactive"
                             DataMemberBinding="{Binding IsDeleted, Mode=TwoWay}"
                             Width="Auto" />
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

Then I tried setting the CellStyle property, but this had no effect:
<telerik:GridViewDataColumn.CellStyle>
    <Style>
        <Setter Property="TextBox.MaxLength" Value="100" />
        <Setter Property="TextBox.Margin" Value="5" />
        <Setter Property="TextBox.Width"
              Value="{Binding ActualWidth, RelativeSource={RelativeSource
                 Mode=FindAncestor, AncestorType={x:Type telerik:GridViewCell}}}" />
    </Style>
</telerik:GridViewDataColumn.CellStyle>
Stefan
Telerik team
 answered on 22 Jun 2016
3 answers
99 views

Hi,

I'm using Isolated Storage, and save a value to both the TreeListView and it's GridViewDataColumn...but when my page comes up the saved sorting value is not being used, so I have to use a third value and read it and manually sort:

 

XAML:

            <telerik:Label x:Name="ProjectTreeViewOrdering" Content="ASC" Visibility="Collapsed" telerik:PersistenceManager.StorageId="THOR_ProjectsTreeSorting" />

 

CODE:

        string[] projectsSortingIsolatedStorage = { "THOR_ProjectsTreeSorting" };

 

        private void OnWindowLoaded(object sender, EventArgs e)
        {

                isoProvider.LoadFromStorage(projectsSortingIsolatedStorage);

                IEnumerable<TreeProjectViewModel> projects = ProjectsTreeView.ItemsSource as IEnumerable<TreeProjectViewModel>;
                if (ProjectTreeViewOrdering.Content.Equals("Ascending"))
                {
                    ProjectsTreeView.ItemsSource = projects.OrderBy(p => p.Name);
                }
                else if (ProjectTreeViewOrdering.Content.Equals("Descending"))
                {
                    ProjectsTreeView.ItemsSource = projects.OrderByDescending(p => p.Name);
                }

...which gets my TreeListView sorted, but then all the Groups collapse, which I don't want.

Using "ExpandAllGroups" had no effect.

If anyone has a better and more proper way to sort, save, and load a RadTreeListView that has a GridViewDataColumn defined within it, I sure would love to know about it. To get the list sorting to persist, I currently have a value save in the TreeListView, the GridViewDataColumn, and a "desperate" label as seen above.3 values seems like overkill to get the job done. I found without the value int he GridViewDataColumn being saved, I'd get no arrows in the TreeListView control, which was bad. Without the label value being stored, I got no sorting capability....so it's all bad at the moment.

Barry

 

 

 

Stefan
Telerik team
 answered on 22 Jun 2016
3 answers
124 views

Hi, I have a RadGridView which is setup to have:

RowVirtualization=True
ColumnVirtualization=True
SelectionMode=Extended
ClipboardCopymode=Cells,Header
AutoGenerateColumns=False

There are 6 columns in this grid all bound to strings similar to
<telerik:GridViewDataColumn Header="FirstName"  DataMemberBinding="{Binding Name}">

I have populated the grid with ~60,000 records

Pressing ctrl+A to select all takes about 3 seconds (which I am ok with I guess)
My problem is pressing Ctrl+C to copy all the rows just freezes the UI and it never finishes (I force closed the app after about 5 minutes if I walk away for about 20 it finishes eventually)

Why does copying all these rows take so long? Is there a way I can speed it up?
I made sure I populated the grid completely first so all this time taken is purely the copy method?

 

Stefan
Telerik team
 answered on 22 Jun 2016
2 answers
209 views

Hello,

 

I am using a RadGridView with a RadDataPager to display a collection of items.

I use a GridViewSelectColumn to enable to select some of these items and to perform actions only on those who are selected.

My issue is that when I check the GridViewSelectColumn of some items, if I change the page and that I go back to the previous one, the items are not selected anymore.

I searched the forum and tried a few things but nothing worked.

 

Thanks in advance.

Regards,
Adrien.

Adrien
Top achievements
Rank 1
 answered on 22 Jun 2016
1 answer
149 views

Hello,

when I bind the TaskSource of the RadGanttView (WPF) to a CompositeCollection I get the Exception "Object of Type System.Windows.Data.CollectionContainer cannot be converted to Type IGanttTask". With the RadTreeView it works. All Items in the Collections implements IGanttTask.

<CompositeCollection x:Key="ProjectChildCollection"><br>               
<CollectionContainer Collection="{Binding DataContext.SelectedProject.ProjectActions, Source={x:Reference control}}" /><br>               
<CollectionContainer Collection="{Binding DataContext.SelectedProject.Tasks, Source={x:Reference control}}" /><br>               
<CollectionContainer Collection="{Binding DataContext.SelectedProject.ResourceBookings, Source={x:Reference control}}" /><br>           
</CompositeCollection>

 

TasksSource="{Binding Source={StaticResource ProjectChildCollection}}"

Nasko
Telerik team
 answered on 22 Jun 2016
1 answer
156 views

Hello,

I'm using RadTabControl with TabStripPlacement="Left" 

In the past the RadTabItems were shown on the left side from top to bottom. Now they are placed from bottom to top. When changing the code to TabStripPlacement="Right" they are listed from top to bottom - like I want it happen on the left side.

I think I haven't changed anything. May it be a change in one of the two last versions?

 

Regards,

Raul

Kiril Vandov
Telerik team
 answered on 22 Jun 2016
6 answers
251 views
Hi all,

I am working on a WPF application using Telerik (http://www.telerik.com/) and coded in C# .NET.
My following question goes over an ASP .NET page using the model “Code behind” to implement the logic of the page.

I would like to get the position of the GanttPresenterSplitter in a <telerik:RadGanttView>.
This information would allow me to set the position of another element in another part of the same screen.
I would also know if it is possible to add an event handler on that GanttPresenterSplitter in order to get its position each time that line moves.

The ASP .NET page is split into 3 parts (please find in attachment "draft_screen.png") :
- Red square : <telerik :RadGanttView>
- Green square : <telerik :RadGridView>
- Blue square : <telerik :RadScheduleView>

As you can see, there is a dividing line between <telerik :RadGridView> and <telerik :RadScheduleView>.
I would like that line moves at the same time and same position as the GanttPresenterSplitter in the RadGanttView.

Using a more explicit picture based on an example (please find in attachment "explicit_screen.png") :
- Orange line : GanttPresenterSpliter
- Purple line : GridSplitter

My point is to coordinate the orange and the purple lines in order they have the same position all the time.

Any help will be much appreciated J
Brieuc
Top achievements
Rank 1
 answered on 21 Jun 2016
2 answers
129 views

Hello!

I have started to use the RadLayoutControl and it works great. However I am wondering if it is possible to save the layout after the user has made some changes to it?

Pontus
Top achievements
Rank 1
 answered on 21 Jun 2016
1 answer
728 views

Hi all,

I am working on a WPF application using Telerik UI for Silverlight (http://demos.telerik.com/silverlight/#RichTextBox/TelerikEditor) and coded in C# .NET.
I took the code of the previous link  and set it up to fit my needs.
I am now facing to an issue : How to directly load by coding a .rtf document into a RadRichTextBox ?

I tried two ways :
RtfFormatProvider provider = new RtfFormatProvider();
RadDocument = null;
using (FileStream stream = new FileStream(FileName, FileMode.Open))
{
    document = provider.Import(stream);
}
DocumentFragment docFrag = new DocumentFragment(document);
radRichTextBox.InsertFragment(docFrag);

-> But that way causes an error because the “Import” method returns a RadFlowDocument whereas I am expecting a RadDocument.

RtfFormatProvider provider = new RtfFormatProvider();
            Telerik.Windows.Documents.Model.Section section = new Telerik.Windows.Documents.Model.Section();
            Telerik.Windows.Documents.Model.Paragraph paragraph = new Telerik.Windows.Documents.Model.Paragraph();
            string line;

            using (StreamReader stream = new StreamReader(FileName))
            {
                while ((line = stream.ReadLine()) != null)
                {
                    Telerik.Windows.Documents.Model.Span span = new Telerik.Windows.Documents.Model.Span(line);
                    try
                    {
                        paragraph.Inlines.Add(span);
                    }
                    catch(Exception e)
                    {
                        string x = e.StackTrace;
                    }
                }
            }
            section.Blocks.Add(paragraph);
            radRichTextBox.Document.Sections.Add(section);

-> There, even if there is no error, the problem is that nothing is shown in the editor.

The most strange is that, when I run the program without trying to load any document at the opening, the window opens perfectly and all the buttons react with the right behavior (see attachment “RadRichTextBoxEditor.png”) but I am not allowed to load a .rtf document whereas it is allowed on the link provided at the top of this topic. (see attachment “notSupportedRTF.png”)

Any help or tip will be much appreciated :)

Tanya
Telerik team
 answered on 21 Jun 2016
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?