Telerik Forums
UI for WPF Forum
3 answers
264 views
Hi,

I'm having problems with binding my items within a gridview controltemplate. I've already followed the WPF examples of it (GridView Examples - Appearence - Custom Row Layout), but whatever I try, binding isn't working when the RowStyle/ControlTemplate is active.

Below a simplified code snippet from the example, but with my own binding names:
<Grid>
        <Grid.Resources>
            <ControlTemplate x:Key="MyCustomRowTemplate" TargetType="telerik:GridViewRow">
                <Border x:Name="rowsContainer" BorderThickness="0,0,0,1">
                    <Grid Width="Auto" HorizontalAlignment="Stretch">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="150" />
                        </Grid.ColumnDefinitions>
 
                        <TextBlock Text="Data1: " Margin="5,0,0,0" FontWeight="Bold" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"  />
                        <TextBlock Text="{Binding Data1}" Margin="5,0,0,0" Grid.Row="0" Grid.Column="1"  VerticalAlignment="Center" HorizontalAlignment="Left"/>
                        <TextBlock Text="Data2: " Margin="5,0,0,0" FontWeight="Bold" Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"  />
                        <TextBlock Text="{Binding Data2}" Margin="5,0,0,0" Grid.Row="1" Grid.Column="1"  VerticalAlignment="Center" HorizontalAlignment="Left"/>
                        <TextBlock Text="Data3: " Margin="5,0,0,0" FontWeight="Bold" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"  />
                        <TextBlock Text="{Binding Data3}" Margin="5,0,0,0" Grid.Row="2" Grid.Column="1"  VerticalAlignment="Center" HorizontalAlignment="Left"/>
                    </Grid>
                </Border>
            </ControlTemplate>
            <Style x:Key="rowStyle" TargetType="telerik:GridViewRow">
                <Setter Property="Template" Value="{StaticResource MyCustomRowTemplate}" />
            </Style>
        </Grid.Resources>
 
        <telerik:RadGridView RowStyle="{StaticResource rowStyle}" ItemsSource="{Binding Contacts}" ShowGroupPanel="False"
             BorderThickness="0" IsFilteringAllowed="False" AutoGenerateColumns="False" CanUserFreezeColumns="False" >
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Data1" DataMemberBinding="{Binding Data1}"/>
                <telerik:GridViewDataColumn Header="Data2" DataMemberBinding="{Binding Data2}"/>
                <telerik:GridViewDataColumn Header="Data3" DataMemberBinding="{Binding Data3}"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>

You see the bindings to Data1, Data2, Data3, but as soon as I run it, those field stay empty, see screenshot 1

However, when I remove the RowStyle="{StaticResource rowStyle}" in my RadGridView then the Data is displayed correctly in the row, see screenshot 2

I've already tried binding with Path=, or CurrentItem.Data1 and several other options, but none of it works, while it works in de example.

I'm problably missing something, but if I compare my code with the example, I don't see any difference in binding, so any help would be appreciated.

Thanks in advance
Rutger Kars
Top achievements
Rank 1
 answered on 06 Dec 2012
4 answers
190 views
Hi,
    I am relatively new to WPF and Telerik RadGridView. I have a requirement to validate my cell column in heiarchical gridview in WPF. Means suppose when the user clicks on the column and enters a value, we should be able to check the db and validate whether the data entered is right or wrong and show proper messages. I am using WPF with MVVM and EF. Can you please suggest me the best possible way to achieve this functionality.

Thanks & Regards
Somasekharan Thampi S
Somasekharan
Top achievements
Rank 1
 answered on 06 Dec 2012
3 answers
661 views
I have some data that is coming from a Stored procedure which i have been able to display in a non-Telerik DataGrid.  using the following code.

CBFdataDataContext conn = new CBFdataDataContext();
List<spTotalRevByZipResult> sptotalrevbyzipresult = (from s in conn.spTotalRevByZip()
select s).ToList();
ZipGrid.ItemsSource = sptotalrevbyzipresult;

But with using the radCartesianChart, It says that there is no ItemSource.
<telerik:RadCartesianChart HorizontalAlignment="Left" Margin="10,104,0,0" Grid.Row="1" VerticalAlignment="Top" Width="723" Height="218" Name="ZipGrid">
           <telerik:RadCartesianChart.VerticalAxis>
               <telerik:LinearAxis/>
           </telerik:RadCartesianChart.VerticalAxis>
           <telerik:RadCartesianChart.HorizontalAxis>
               <telerik:CategoricalAxis/>
           </telerik:RadCartesianChart.HorizontalAxis>
           <telerik:RadCartesianChart.Series>
               <telerik:BarSeries CategoryBinding="subTotal"
                                  ValueBinding="custzip"
                                  ItemsSource="{Binding}"/>
           </telerik:RadCartesianChart.Series>
       </telerik:RadCartesianChart>
So How do i load the chart with Data?
CBFsqldataDataContext conn = new  CBFsqldataDataContext();
            List<spTotalRevByZipResult> sptotalrevbyzipresult = (from s in conn.spTotalRevByZip()
                                                                 select s).ToList();
             
            ZipGrid????????? = sptotalrevbyzipresult;











Petar Kirov
Telerik team
 answered on 06 Dec 2012
1 answer
121 views
I created a test project and used the Metro style resource dictionary provided with the WPF tools to create the look for our project's scheduler.  However, moving the style over to the main project, none of the visuals are working--Drag & Drop time markers don't appear, nor does a mouse-over for the cells indicating which cell you are on.  Resizing appointments also lacks visuals.  It's like the scheduler is completely static in terms of visual cues.  Unfortunately I haven't been able to reproduce this in a sample project, and our main project's code isn't practical to post.  I'm hoping someone has encountered this and can offer some suggestions. I've attached a screen grab showing the setup of our day view just to add a little context.
Vladi
Telerik team
 answered on 06 Dec 2012
3 answers
230 views
Hi,

I have stantard MVVM scenario, when I exposed ReadOnlyObservableCollection as a public property on my ViewModel. I add or remove items by commands, because it involves additional domain logic. I dont want to make the source collection public to ensure consistency of my model.

In treeview I solved it nicely with PreviewDragEnded="RadTreeView_PreviewDragEnded"
How to do it with RadListBox?

Thanks.
Daniel 
Vladi
Telerik team
 answered on 06 Dec 2012
5 answers
667 views
Hi,

Im trying to use RadRichTextBox together with the Ribbon control to get a Word-like text editor in my application.

So far I've initialized the editor with some content, which can be either plain text, RTF of HTML, so I used the different format providers and its working like a charm.

Now I want to be able to insert content at the caret position. For inserting plain text, I'm using the Insert method, and its working fine, but how do I insert RTF and HTML? On top of that, the inserted RTF or HTML should keep its original formatting and style.

/giereck


Stefan
Telerik team
 answered on 06 Dec 2012
3 answers
375 views
Let me start this with, I am using the Q2 2012 version and this is my first attempt at using this control...

I am trying to use the pie chart to render data from database based on the dates entered by the user.  The user can reset these dates at any time and in which case I need to update the pie chart based on the new dates.  I have done this by setting up events and when the user enters the date, then I will refresh my pie chart data.

Problem 1) So at first I figured the easiest way to do this would be clear the points and re-add them.  However, this would throw an error stating index out of range.  In debug this was looking for the PieSeries.cs file.  You can reproduce this by displaying some data and then on the click of a button call pieChart.Series[0].DataPoints.Clear().  I can provide a call stack if necessary.

Problem 2) I then went back and added all the required datapoints in xaml and gave them a name.  I then changed it to use those named points and reset the values.  Now when I update the values and the labels, the chart itself is not updating.  Is there some call to tell the chart to re-evaluate the values?

Problem 3) When the user selects a date range that does not contain any data to be displayed, I need to update the chart to reflect this.  I currently set the points value to 0, but it doesn't update to reflect 0 values.  What is the best way to accomplish this?

Problem 4) When the user is hovering over a slice in the pie, I want to either be able to "explode" that slice or at least update the tooltip to reflect some other internal data.  I noticed in posts from the past that the "explode" event was ready, but is it ready now?  If so then what is the event?  If this event is not there then could you at least tell me how in the TooltipOpening even I can get the datapoint that the mouse is currently hovering over?

Thanks in advance for your time and efforts.
Lee Keel
Ves
Telerik team
 answered on 06 Dec 2012
0 answers
109 views
Hi All,

I am having 15 columns in my RadGridview. In the UI it shows 10 columns to see other 5 column i have to scroll horizontally. When i reorder the column,horizantal scroll bar is not scrolling some thing like in the screenshot. Is there any way to enable the horizontal scrollbar to move when i reorder? Please advise me on this.

Check the screenshot below :



Sakthi
Top achievements
Rank 1
 asked on 06 Dec 2012
7 answers
246 views
Hi,

For many properties I often initialise the underlying field in the get accessor. ie
public User SelectedCreatedBy
        {
            get
            {
                if (_SelectedCreatedBy != null)
                    _SelectedCreatedBy = new User();
                return _SelectedCreatedBy;
            }
            set
            {
                if (_SelectedCreatedBy != value)
                {
                    _SelectedCreatedBy = value;
                    RaisePropertyChanged(() => SelectedCreatedBy);
                }
            }
        }
But binding "SelectedItem" to this property crashes the program when I start typing. If I remove the initialisation part, it works. ie:
public User SelectedCreatedBy
        {
            get
            {
                return _SelectedCreatedBy;
            }
            set
            {
                if (_SelectedCreatedBy != value)
                {
                    _SelectedCreatedBy = value;
                    RaisePropertyChanged(() => SelectedCreatedBy);
                }
            }
        }

Was this a design decision with RadAutoCompleteBox or a bug? I've never had this problem with any other telerik controls.
Peter
Top achievements
Rank 1
 answered on 06 Dec 2012
0 answers
257 views
I would like to have the gridview paging size dynamically adjusted when gridview height changed, so that the grid would not have any void, nor would user require to scroll up and down.

I handled the gridview's SizeChanged event and tried the following code:

private void ItemsList_SizeChanged(object sender, SizeChangedEventArgs e)
{
    if (e.HeightChanged && ItemsList.ActualHeight > 0)
    {
        var pageSize = (int)(ItemsList.ActualHeight / ItemsList.RowHeight);
        if (ItemsList.ShowColumnHeaders)
            pageSize--;
        if(pageSize > 0)
            ItemPager.PageSize = pageSize;
    }
}

It pretty much worked, except when the column header is visible, as it the taller than the row height, the above calculation is not exact anymore. It also doesn't handle when horizontal scrollbar is visible.

Is there a better way to calculate the number of rows that should be visible?
Wenrong
Top achievements
Rank 1
 asked on 05 Dec 2012
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
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?