Telerik Forums
UI for WPF Forum
3 answers
257 views
Right now I've got a RadGridView that is using a sort and group headers. I've been thinking of adding an additional field (currently commented out) to give the users more information so they can make more intelligent decisions as to which row in the grid view to select. However, as has been pointed out to me, if I did that, then there would be the date of birth, appointment date and interview date, one right after another. Making a rather busy UI which would be hard to figure out. So I've been thinking about replacing the GridViewDataColumns I currently have displayed for each detail row, with a data template instead. That way I could put in labels, probably put that information into a regular XAML grid or maybe a stack panel, and just make the UI easier to read and interpret. But I'm concerned about potentially messing up my sort and group headers of the RadGridView. This is the first time I've used those in a WPF app. So, my question is can I replace those individual GridViewDataColumns I currently use for the details rows, with a DataTemplate and still not mess up my sorts and group headers?

Here is the XAML. The ItemsSource is assigned in the code-behind:

<telerik:RadGridView  VerticalAlignment="Stretch" AutoGenerateColumns="False" DataMember="ClientNumber"
    x:Name="grdClients" telerikControls:StyleManager.Theme="Transparent" d:DataContext="{d:DesignData Source=/SampleData/ASISelectClientSampleCollection.xaml}"
    IsReadOnly="True" ShowColumnHeaders="False" ShowGroupPanel="False"
    RowIndicatorVisibility="Collapsed"
    IsFilteringAllowed="False" AutoExpandGroups="True" FontSize="16" SelectionChanged="grdClients_SelectionChanged"
    ItemsSource="{Binding}" HorizontalAlignment="Left" MouseDoubleClick="grdClients_MouseDoubleClick" Margin="50,25,0,0" >
 
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn UniqueName="ClientNumber" Width="SizeToCells">
            <telerik:GridViewDataColumn.ToolTipTemplate>
                <DataTemplate>
                    <TextBlock Text="Client Number" />
                </DataTemplate>
            </telerik:GridViewDataColumn.ToolTipTemplate>
        </telerik:GridViewDataColumn>
        <telerik:GridViewDataColumn UniqueName="LastName">
            <telerik:GridViewDataColumn.ToolTipTemplate>
                <DataTemplate>
                    <TextBlock Text="Last Name" />
                </DataTemplate>
            </telerik:GridViewDataColumn.ToolTipTemplate>
        </telerik:GridViewDataColumn>
        <telerik:GridViewDataColumn UniqueName="FirstNames">
            <telerik:GridViewDataColumn.ToolTipTemplate>
                <DataTemplate>
                    <TextBlock Text="First Name" />
                </DataTemplate>
            </telerik:GridViewDataColumn.ToolTipTemplate>
        </telerik:GridViewDataColumn>
        <telerik:GridViewDataColumn UniqueName="CaseNumber" Width="SizeToCells">
            <telerik:GridViewDataColumn.ToolTipTemplate>
                <DataTemplate>
                    <TextBlock Text="Case Number" />
                </DataTemplate>
            </telerik:GridViewDataColumn.ToolTipTemplate>
        </telerik:GridViewDataColumn>
        <telerik:GridViewDataColumn UniqueName="DateOfBirth" DataFormatString="{}{0:d}" Width="SizeToCells">
            <telerik:GridViewDataColumn.ToolTipTemplate>
                <DataTemplate>
                    <TextBlock Text="DOB" />
                </DataTemplate>
            </telerik:GridViewDataColumn.ToolTipTemplate>
        </telerik:GridViewDataColumn>
        <!--<telerik:GridViewDataColumn UniqueName="AppointmentDate" DataFormatString="{}{0:d}" Width="SizeToCells">
            <telerik:GridViewDataColumn.ToolTipTemplate>
                <DataTemplate>
                    <TextBlock Text="Appointment date - the scheduled date of the assessment" />
                </DataTemplate>
            </telerik:GridViewDataColumn.ToolTipTemplate>
        </telerik:GridViewDataColumn>-->
        <telerik:GridViewDataColumn UniqueName="InterviewDate" DataFormatString="{}{0:d}" Width="SizeToCells">
            <telerik:GridViewDataColumn.ToolTipTemplate>
                <DataTemplate>
                    <TextBlock Text="Interview Date - the date the assessment began" />
                </DataTemplate>
            </telerik:GridViewDataColumn.ToolTipTemplate>
        </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
    <telerik:RadGridView.SortDescriptors>
        <telerik:SortDescriptor Member="LastName" SortDirection="Ascending" />
        <telerik:SortDescriptor Member="FirstNames" SortDirection="Ascending" />
        <telerik:SortDescriptor Member="CaseNumber" SortDirection="Descending" />
    </telerik:RadGridView.SortDescriptors>
    <telerik:RadGridView.GroupDescriptors>
        <telerik:GroupDescriptor Member="ClientNumber"/>
    </telerik:RadGridView.GroupDescriptors>
    <telerik:RadGridView.GroupHeaderTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <StackPanel  Orientation="Horizontal" Width="250">
                    <TextBlock Text="{Binding Group.Items[0].LastName}" />
                    <TextBlock Text=", " />
                    <TextBlock Text="{Binding Group.Items[0].FirstNames}" />
                </StackPanel>
                <StackPanel Margin="10,0,0,0" Orientation="Horizontal">
                    <TextBlock Text="{Binding Group.Items[0].SocialSecurityNo}" FontWeight="Bold"  />
                </StackPanel>
            </StackPanel>
        </DataTemplate>
    </telerik:RadGridView.GroupHeaderTemplate>
</telerik:RadGridView>
Dimitrina
Telerik team
 answered on 11 Feb 2014
2 answers
119 views
Hi,

Is there any way i can align the text of the MessageBoxs and Alerts  to the right?

Thx,
M
Yana
Telerik team
 answered on 11 Feb 2014
1 answer
132 views
Hi All

I have a WPF RadCalendar control where I use a DayTemplate Selector to present cells based on a lookup from a database.

The basic premise if that when particular conditions are met the cells will change colour or display different shapes and the like.

I have this working fine, but I have an issue where once the DayTemplateSelector has repainted the cells in the calendar, the Selected Day is no longer shown as selected. If I check the SelectedDate property of the calendar in my code behind, its correct - but the calendar is not displaying it.

If I click on that date again, the selected date is shown correctly.

Is there some way of forcing the calendar to show the selected date again after the calendar has finished rendering using the DayTemplateSelector?

I have tried setting the selectedDate to nothing then back to the correct date to see if that would trigger the selected date to be displayed, but it didn't. It seems to only show the selection when clicked from the UI.

Any thoughts or suggestions would be very much appreciated.

I am using 2012.RadControls_for_WPF_2012_2_0912_Dev_hotfix version of the Calendar control in DotNet 4.0 application.

Its using MVVM with Prism4, so everything is handles through bindings.

Cheers

Rod.
Kalin
Telerik team
 answered on 11 Feb 2014
6 answers
997 views

Hi Team,

I Need to Insert a new row on top of the RadGridView using BeginInsert() method.
The ItemsSource of RadGridView is assigned dynamically.

Is there any property or method available to add new record in a first row of the RadGridView.

Regards.
Shanthi

Maya
Telerik team
 answered on 11 Feb 2014
2 answers
164 views
Hi,
I am not sure if I am losing it or there is actually a bug with DocumentTextSearch. I have a document for which I want to find a replace some text. all the text that needs to be replace matches this regular expression {{(.*?)}}. Now the code below works for everything except if the text has a number in it. For example, say I want to match {{COM_LDL}}, then this gets matched perfectly. but if i want to match {{COM_LDL1}} then only {{COM_LDL is matched and the rest is disregarded. Below is the code, can somebody please help?
Thanks,
Roy

 DocumentTextSearch search = new DocumentTextSearch(rtb.Document);
                List<TextRange> rangesTrackingDocumentChanges = new List<TextRange>();
                foreach (var textRange in search.FindAll("{{(.*?)}}")) //find all merge fields
                {
                    TextRange newRange = new TextRange(new DocumentPosition(textRange.StartPosition, true), new DocumentPosition(textRange.EndPosition, true));
                    
                    rangesTrackingDocumentChanges.Add(newRange); --> this is where the problem happens.  if there is a number (COM_LDL1) then newRange.StartPosition.ToString() returns "\"{{COM_LDL\"@0" if there isnt a number then newRange.StartPosition.ToString() works perfectly and returns "\"{{COM_LDL}}\"@0"

                }
Roy
Top achievements
Rank 1
 answered on 11 Feb 2014
3 answers
301 views
I have a RadGridView that's bound to the DataView of a DataTable.  Whenever the underlying database table contains a boolean column, RadGridView appropriately (and automatically) renders that column using a GridViewCheckBoxColumn.  However, by default, it takes 3 mouse clicks to modify the value of any given checkbox.  I've read the help topics on reducing the click count to either 2 clicks or 1 click.

I'd like to start by setting the EditTriggers property for every GridViewCheckBoxColumn to "CellClick" - which according to the docs should reduce my click count to 2.  However, I'm not sure of the appropriate place to make that adjustment.  I assumed that from within the AutoGeneratingColumn event handler, I could detect the current column was a GridViewCheckBoxColumn and simply set the property there.

However, examining the arguments passed into that method (the RadGridView itself and a GridViewAutoGeneratingColumnEventArgs object), I didn't see anything which indicated the current column was a GridViewCheckBoxColumn.

I know I can *create* my own, new GridViewCheckBoxColumn from within that event handler, but is that really necessary since it already exists?  Also, in order to create my own column, I'd need to know that the current db column is indeed a Boolean (by *type*, not by field name) - which I haven't found a way to determine from within the event handler either.

I also tried to add the following Style to the view's XAML, but it didn't seem to have any effect:

<UserControl.Resources>
    <ResourceDictionary>
        <Style TargetType="telerik:GridViewCheckBoxColumn">
            <Setter Property="EditTriggers" Value="CellClick" />
        </Style>
    </ResourceDictionary>
</UserControl.Resources>

Note that I am using implicit styles that can be changed at runtime - in case that impacts the validity of the above style setting...

So, what's the best way to set the EditTriggers property on an AutoGenerated column?

Thanks,

Jeff
Jeff
Top achievements
Rank 1
 answered on 11 Feb 2014
3 answers
1.0K+ views
Hi, 

I'm trying to place two grids in a window that looks like the below.

----------------------------------------------------------------
|                                                                              |
----------------------------------------------------------------
|                              |           |                                    |
|        GridView      |           |        GridView            |
|          Here            |           |          Here                 |
|                              |           |                                    |
|                              |           |                                    |
|                              |           |                                    |
|                              |           |                                    |
|----------------------------------------------------------------
|                                                                              |
----------------------------------------------------------------

Now the grids should resize with the window. This led me create a Grid with the following row and column definitions.
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

This works great when there aren't very many items in the gridviews but the gridview in the left will almost always have over 1500 items in it. I did read your documentation where it states that placing gridviews in a spot where it measures infinity it will perform slowly. How would you recommend I layout the view so that the grid resizes with the window and still allows for a large amount of items?
Carlos
Top achievements
Rank 1
 answered on 10 Feb 2014
1 answer
114 views
What effect, if anything, does putting a slash in from of the field bound to the control, have? For example:

<telerik:RadMaskedNumericInput
    Grid.Column="1"
    HorizontalAlignment="Left"
    Grid.Row="2"
    Margin="5,0,0,0"
    VerticalAlignment="Bottom"
    Mask="####"
    FontFamily="Century Gothic"
    FontSize="16"
    Value="{Binding /ProbationStartYear}"
    IsClearButtonVisible="False"
    AutoFillNumberGroupSeparators="False" />
Boris
Telerik team
 answered on 10 Feb 2014
1 answer
238 views
 I updated my WPF controls and now my border is blank when I set my border thickness to 0.5, the border is blank, or doesn't show.

  myMaskedTextBox.BorderThickness =  new Thickness(0.5);

if do: 
  myMaskedTextBox.BorderThickness =  new Thickness(1);  it's ok, but thicker than I want.

Sia
Telerik team
 answered on 10 Feb 2014
11 answers
906 views
Hello,

How can I hide filtering options?  I do not want to display the 'And / Or' dropdown as well as the 'Is equal to' dropdown and the textbox that goes along with it.  I tried using the DistinctFiltersVisibility property, but it did not hide those options.  Is that not what it is supposed to do?  Do I need to override the template and do custom filtering to hide these options?
Yoan
Telerik team
 answered on 10 Feb 2014
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
ProgressBar
Sparkline
LayoutControl
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
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?