Telerik Forums
UI for WPF Forum
1 answer
190 views
Hello,

I have a RadGridView where I am autogenerating columns from a datatable. Some columns need a converter on the values, and the conversion logic is different from column to column.

I am using the following code in the autogenerating column event to set the template to an object with a textblock and the right converter.

                var cellStyle = new Style();
                Setter setter = new Setter();
                setter.Property = TemplateProperty;
                var template = new ControlTemplate();
                var index = "[" + ((RadGridView)sender).Columns.Count.ToString() + "]";
                FrameworkElementFactory spFactory = new FrameworkElementFactory(typeof(System.Windows.Controls.ListBox));

                var value = new MultiBinding();
                value.Bindings.Add(new Binding(index));
                var columnBinding = new Binding();
                columnBinding.Source = e.Column.Header.ToString();
                value.Bindings.Add(columnBinding);
                value.Converter = (IMultiValueConverter)this.FindResource("TupleCreator");

                spFactory.SetValue(DataContextProperty, value);
                spFactory.SetValue(TemplateProperty, (ControlTemplate)this.FindResource("DataTemplate"));

                template.VisualTree = spFactory;
                setter.Value = template;
                cellStyle.Setters.Add(setter);

                e.Column.CellStyle = cellStyle;

This works fine for actually viewing the cells in the grid, and using visualization so that not all of the conversions are done at once. What I need to be able to do is filter and sort by these values, as well as have them in the cells of export to excel.

I have seen something similar done in another control using an unbound column data event.

Thanks,

Eli
Rossen Hristov
Telerik team
 answered on 16 Apr 2013
8 answers
249 views
Hi,
We are using SparkLine in one column of GridView, we are getting issue that when user scrolls the grid down and move back then extra dots are visible in the grid. Please find the issue in attached image and we have also attached the sample code to regenerate the issue.
we are using 2011.2.712.40 library build.

Image file
sparkline.jpg

Sample code
how can we attach the code?
Thanks
Tsvetie
Telerik team
 answered on 16 Apr 2013
1 answer
85 views
Hi,

We have been using WPF GridView Q3 2012 version and today upgraded to Q1 2013 but getting many compilation errors. I am attaching the snapshot. Please suggest.

Thanks,
Sandeep
Dimitrina
Telerik team
 answered on 16 Apr 2013
1 answer
172 views
I have a problem where the edit mode is conflicting with the drag/drop. The problem happens because the cell goes into edit mode when the mouse is depressed rather than on a mouse up.

The scenario is that the user has clicked on a row. They happen to have clicked in some random cell. Now they want to drag that row. They click in the same cell expecting that they can drag the row but as soon as they press the mouse down, that cell goes into edit mode. So they can't drag.

Is there a way to tell the grid to use mouse-up rather than mouse-down when deciding whether to put it in edit mode.

Thank you,
Valerie
Nedyalko Nikolov
Telerik team
 answered on 16 Apr 2013
4 answers
259 views
I have a RadGridView populated with data. I have some input controls that allow the user to change the font of the text in the header rows. I tried the following in the code-behind, but it did not work. What is the correct way to do this?

System.Windows.Style headerStyle = new Style();
headerStyle.BasedOn = reportGrid.Columns[0].HeaderCellStyle;
headerStyle.TargetType = typeof(GridViewHeaderCell);
headerStyle.Setters.Add(new Setter(GridViewHeaderCell.FontSizeProperty, 25));
reportGrid.Columns[0].HeaderCellStyle = headerStyle;

Kind Regards,
Albert
Dimitrina
Telerik team
 answered on 16 Apr 2013
18 answers
1.1K+ views
Hi, 

I've found an example on how to change the theme at runtime with silverlight but I need to do it with WPF, is it possible ?

Also, I've applied a theme to the VS2010 controls like this:

        <Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:VistaTheme, ElementType=TextBox}}" />
        <Style TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:VistaTheme, ElementType=ScrollViewer}}" />
        <Style TargetType="{x:Type RadioButton}" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:VistaTheme, ElementType=RadioButton}}" />
        <Style TargetType="{x:Type ListBox}" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:VistaTheme, ElementType=ListBox}}" />
        <Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:VistaTheme, ElementType=CheckBox}}" />
        <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:VistaTheme, ElementType=Button}}" />
        <Style TargetType="{x:Type PasswordBox}" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:VistaTheme, ElementType=PasswordBox}}" />
        <Style TargetType="{x:Type RepeatButton}" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:VistaTheme, ElementType=RepeatButton}}" />

But I need their theme to follow the application's theme (and follow it too if it changes).

I hope you can help me.

Thanks.
Amin
Top achievements
Rank 1
 answered on 16 Apr 2013
2 answers
308 views
if you setup hierarchy and you want bind / display info in the child grid for the parent row it belongs to..in the xaml/bing how can you get reference to parent row from the child as part of databinding...

<telerik:RadGridView Name="gridView" ItemsSource="{Binding Person}">
    <telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition />
    </telerik:RadGridView.ChildTableDefinitions>
    <telerik:RadGridView.HierarchyChildTemplate>
        <DataTemplate>
            <StackPanel>
            <TextBlock Text="{Binding ParentRow.SomeProperty}"/>
            <telerik:RadGridView ItemsSource="{Binding Children}" Name="childGrid" ShowGroupPanel="False" />
            </StackPanel>
        </DataTemplate>
    </telerik:RadGridView.HierarchyChildTemplate>
</telerik:RadGridView>
Dan
Top achievements
Rank 1
 answered on 15 Apr 2013
12 answers
320 views
Hi!

I have a TileView and TileConfigView UserControls and I would like to show pre-designed TileView (TileView.xaml) as RadFluidContentControl.Content and pre-designed TileConfigView (TileConfigView.xaml) as RadFluidContentControl.LargeContent.

I Was able to bind TileView to .Content using {Binding TileContent} but for some reason the tile's size is not the same as the TileView UserControl's size. In addition I needed to make property to TileView's codebehind for it to work because I don't know how to get the view from the viewmodel:

// in TileView.xaml.cs
public TileView TileContent
{
    get { return this; }
}

But if I want to have different view for .LargeContent this seems like not the way to do it.

This is my contentTemplate for RadTileView (Width="Auto" and Height="Auto" didn't help with getting the tile's size match that of the actual view):

<DataTemplate x:Key="contentTemplate">
            <telerik:RadFluidContentControl ContentChangeMode="Manual"
                                            State="Normal"
                                            TransitionDuration="0:0:.5"
                                            DataContext="{Binding}">
                <telerik:RadFluidContentControl.Content>
                    <ContentControl Content="{Binding TileContent}"
                                    Width="Auto"
                                    Height="Auto"
                                    HorizontalContentAlignment="Center"
                                    />
                </telerik:RadFluidContentControl.Content>
                <telerik:RadFluidContentControl.LargeContent>
                    <ContentControl Content="{Binding ConfigContent}"
                     HorizontalAlignment="Stretch"
                     HorizontalContentAlignment="Stretch"
                     VerticalAlignment="Stretch"
                     VerticalContentAlignment="Stretch" />
                </telerik:RadFluidContentControl.LargeContent>
            </telerik:RadFluidContentControl>
        </DataTemplate>

Is there a proper way to do this so that I can have pre-designed TileView and TileConfigView per Tile and have those used as .Content and .LargeContent?

Br,

Kalle
Pavel R. Pavlov
Telerik team
 answered on 15 Apr 2013
2 answers
119 views
Hey Telerik,

The ZIndex of the Special Slots is set to 1 hard coded instead of using the Canvas.ZIndex property of the style of the special slot. This way it's hard to do the correct layering of the slots (in the case there are multiple types). I resolved the issue by one way binding and letting it reevaluate ontargetupdated. The binding result always returns the correct ZIndex property of the type of slot. Just a small bug, however due to the recycling of slots it has some perfomance penalties.

Cheers,
Nico
Shawn Shaddock
Top achievements
Rank 1
 answered on 15 Apr 2013
1 answer
603 views
I thought the Loaded event should only fire when the control is just about to render?

When I programmatically add a tab to the TabControl with a UserControl on it, the Loaded event of the UserControl fires although the tab isn't selected and thus the UserControl shouldn't be rendered.

I'm also asking because I then have the problem that when I set the SelectedItem of the TabControl to be the newly added Tab, the Loaded event of the UserControl gets fired yet again.

So in the process of adding and selecting the tab, the Loaded event of the UserControl gets fired twice which isn't desirable.

Edit: It does only seem to happen if the first tab is added to the TabControl for the first time.

Why is that, and is there a better way to prevent this from happening without resorting to some sort of boolean flag testing solution in the Loaded event handler?
Pavel R. Pavlov
Telerik team
 answered on 15 Apr 2013
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
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?