Telerik Forums
UI for WPF Forum
2 answers
165 views
Hi
 I would like to create a usercontrol that will allow me have a set a predefined columns within a GridView when bound to a collection of our DataContract classes.   What I would like to see is something on the order of the Data Template Selector... but instead, have that at the GridViewDataColumn level.   Here is an example

[DataContract]
public MyDataClass
{
Public SomeEnum EnumProperty {get;set;}
        Public SomeClass SomeClassProperty {get;set;}
Public int SomeIntProperty {get;set;}
}


Now  lets say I have a List<MyDataClass> and I want to bind this to a RadGridView control and have it auto generate the columns based on some defined logic. I know that I could probably do this in the Auto generate event handler in my code behind though a series of if logic or case staements.  But I would prefer it if there was a way that I can define some sort of a GridViewDataColumnSelector to have it automatically define both of the read only and editor templates. Something on the order of what we have for Data Template or Style Template selector except for the entire GridViewDataColumn.

For the example above.. I would like to auto-generate a Combobox for the Enum to provide a list of Enum possible values.  And for the SomeClass property.. I want to create a ComboBox with a list of values bound to collection of possible values. 
Michael C
Top achievements
Rank 1
 answered on 08 May 2012
10 answers
587 views
Hello

When setting the IsEnabled property of a RedNumericUpDown control to false, there is almost no visual change. Only the control does not change its border any more when hovering over it. But there is no gray background or anything like that.
When we experienced that, we tried to do it using a trigger and setting the Background property but the Background property does not seem to work.

Is there any simple solution to that apart from putting a whole new ControlTemplate?

Best regards

Christian
MATEUSZ
Top achievements
Rank 1
 answered on 08 May 2012
2 answers
218 views
Please provide me the code to remove the gradient effect on bar charts, I understand I have to create a custom style to get rid of the default mask but every example on here is either for pie charts or I haven't been able to get them to work.

Telerik WPF 2012_1_0326

Many thanks.

Craig Mellon
Top achievements
Rank 1
 answered on 08 May 2012
3 answers
273 views
I have a RadGridView that displays data from my database.  I have set up a DataTemplate for the RowDetails:

<DataTemplate x:Key="ReadRowDetailsTemplate">
    <Grid HorizontalAlignment="Center">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
                <Label Content="Alarms for this Read:"
                     FontSize="14"
                     FontWeight="Bold"
                     Grid.Column="0"
                     Grid.Row="0"
                     HorizontalAlignment="Center" />
                    <DataGrid AlternatingRowBackground="{DynamicResource AlternatingRowBackground}" 
                           AutoGenerateColumns="False" 
                           CanUserResizeColumns="True" 
                           CanUserSortColumns="False"
                           FontSize="14" 
                           FontWeight="Bold"
                           Grid.Column="0"
                           Grid.Row="1"
                           HorizontalAlignment="Center"
                           IsReadOnly="True"
                           ItemsSource="{Binding Path=Alarms, Mode=TwoWay}"
                           Margin="5" 
                           Name="AlarmsGrid" 
                           ScrollViewer.CanContentScroll="True"
                           ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                           ScrollViewer.VerticalScrollBarVisibility="Auto"
                           SelectionChanged="AlarmsGrid_SelectionChanged"
                           SelectionMode="Single"
                           SelectionUnit="FullRow"
                           VerticalAlignment="Top">
                    <DataGrid.Columns>
                        <DataGridTextColumn Binding="{Binding Path=AlarmClass}"
                                            Header="Alarm Class" />
                        <DataGridTextColumn Binding="{Binding Path=AlarmTime, Converter={StaticResource DateConverter}}"
                                            Header="Time"
                                            Width="150" />
                        <DataGridTextColumn Binding="{Binding Path=ListName}"
                                            Header="Source" />
                        <DataGridTextColumn Binding="{Binding Path=AlarmStatus}"
                                            Header="Alarm Status"/>
                        <DataGridTextColumn Binding="{Binding Path=AlarmRejectedReason}"
                                            Header="Reason" />
                    </DataGrid.Columns>
                </DataGrid>
            </Grid>
        </DataTemplate>
In order to speed loading of the data, I have implemented the following:

  1. I have implemented a class called CustomGridViewToggleRowDetailsColumn which descends from GridViewBoundColumnBase.  This class has properties that allow me to hide the GridViewToggleButton for a row if that row does not have any row details.  It also has a Click event that is raised whenever the user clicks on the GridViewToggleButton.
  2. In my class that populates the rows of the RadGridView, I have implemented INotifyPropertyChanged.
  3. In the window that has the RadGridView, I retrieve my data from the database but leave the Alarms property (which is bound to the DataGrid's ItemsSource property in the DataTemplate) set to null initially.  A bool property called HasAlarms is set to true if the row has Alarms associated with it.
  4. In the window that has the RadGridView, I have a Click event handler for the custom Click event I mentioned in #1.  This checks to see if the Alarms property for the row that was clicked is null.  If it is, it goes to the database and retrieves the Alarms.  Note that this event can't happen unless HasAlarms is set to true for that row.

This is all working, but the DataGrid remains empty after the RowDetails are displayed.  What am I missing to make this work?

Tony

Tony
Top achievements
Rank 1
 answered on 08 May 2012
10 answers
343 views
Hi,

actually with my VS2008 I use V2011.3.1220.35 and I'm trying to upgrade to V2012.1.326.35 and I have some questions. Actually
my "C:\Program Files (x86)\Telerik\RadControls for WPF Q3 2011 SP1" folder contain the following folders:

Binaries
Demos
LicenseAgreements
Themes
VSExtensions

and the new folder ("C:\Users\agosselin\AppData\Roaming\Telerik\Updates\RadControls_for_WPF_2012_1_0326_Dev_hotfix") created by Telerik download process contain the following folders:

Binaries
Binaries.NoXaml
LicenseAgreements
Themes.Implicit

the folders structure are not the same!!! I would like to know what should I do and consider to upgrade my current version of Telerik???

PS: In our development environment, we have a specific folder containing each Telerik versions regarding the one we use with the project we work on.

Thank's
Oliver
Top achievements
Rank 1
 answered on 07 May 2012
2 answers
328 views
I have a reference to an object that is in the RadGridView, but it is not necessarily the currently selected object in the RadGridView, and I need to find the object that immediately precedes or follows it.  I have an ObservableCollection of objects, but the order of the objects in the ObservableCollection does not always match the order of the rows in the RadGridView, since the user can sort the RadGridView.

Is there a way I can retrieve a reference to a collection of the RadGridView's items that is in the same order as the data currently is in the RadGridView?

Tony
Tony
Top achievements
Rank 1
 answered on 07 May 2012
6 answers
192 views
What is the best method to determine if a given Diagram has changed (i.e. attributes of a shape changed, new shape, etc.) when not using a diagram bound with GraphSource?
The Cowboy
Top achievements
Rank 1
 answered on 07 May 2012
0 answers
116 views

I sent a support ticket to the telerik admins asking if there were any API methods to determine if the caret is at the start and end of a line.
They responded with a solution so I thought I should share it with everyone else.

Is Caret at Line Start

public static bool IsCaretAtLineStart(RadDocument document)
{
    DocumentPosition endLinePosition = new DocumentPosition(document.CaretPosition);
    endLinePosition.MoveToCurrentLineStart();
 
    if (document.CaretPosition == endLinePosition)
    {
        return true;
    }
 
    return false;
}


Is Caret at Line End

public static bool IsCaretAtLineEnd(RadDocument document)
{
    DocumentPosition endLinePosition = new DocumentPosition(document.CaretPosition);
    endLinePosition.MoveToCurrentLineEnd();
 
    if (document.CaretPosition == endLinePosition)
    {
        return true;
    }
 
    return false;
}


I hope this helps you as it did myself.

Thanks,

Rob

Robert
Top achievements
Rank 1
 asked on 07 May 2012
5 answers
2.0K+ views
Hi,

I'm trying to use the RadMaskedNumericInput as follows;

<telerik:RadMaskedNumericInput
                Grid.Row="6"
                Grid.Column="1"
                Value="{Binding Mileage}"
                EmptyContent="kilometer"
                FormatString="D"
                Mask="d"
                IsClearButtonVisible="False"
                VerticalAlignment="Center"
                VerticalContentAlignment="Center"
                />

...where the bound 'Mileage'-property is an Int. But when I try to input a number at runtime, I get the following exception;

"Index was outside the bounds of the array."

And the stacktrace;

   at System.String.get_Chars(Int32 index)
   at Telerik.Windows.Controls.RadMaskedNumericInput.GetValidCharOverride(Char ch, Int32& position, Nullable`1 forwardSpin, Boolean& isValid) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\RadMaskedNumericInput.cs:line 625
   at Telerik.Windows.Controls.RadMaskedInputBase.ProcessChar(Char ch, Int32& position, Nullable`1 forwardSpin) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 2693
   at Telerik.Windows.Controls.RadMaskedInputBase.ProcessChar(Char ch, Int32 position, TokenTypes type, Nullable`1 forward, Nullable`1 forwardSpin) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 2641
   at Telerik.Windows.Controls.RadMaskedInputBase.ProcessKey(Char ch, KeyEventArgs args) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 1548
   at Telerik.Windows.Controls.RadMaskedInputBase.OnKeyDownHandled(Char c) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\RadMaskedInputBase.cs:line 476
   at Telerik.Windows.Controls.MaskedInput.PreviewInputTextBox.OnTextInput(TextCompositionEventArgs e) in c:\Builds\WPF_Scrum\Release_WPF\Sources\Development\Controls\Input\MaskedInput\PreviewInputTextBox.cs:line 44
   at System.Windows.UIElement.OnTextInputThunk(Object sender, TextCompositionEventArgs e)
   at System.Windows.Input.TextCompositionEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.TextCompositionManager.UnsafeCompleteComposition(TextComposition composition)
   at System.Windows.Input.TextCompositionManager.PostProcessInput(Object sender, ProcessInputEventArgs e)
   at System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.TextCompositionManager.UnsafeStartComposition(TextComposition composition)
   at System.Windows.Input.TextCompositionManager.PostProcessInput(Object sender, ProcessInputEventArgs e)
   at System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndKeyboardInputProvider.ProcessTextInputAction(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(MSG& msg, Boolean& handled)
   at System.Windows.Interop.HwndSource.WeakEventPreprocessMessage.OnPreprocessMessage(MSG& msg, Boolean& handled)
   at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
.... 
Tina Stancheva
Telerik team
 answered on 07 May 2012
2 answers
288 views
Hi,

I have two questions, first i have a button in a column, but when a put the gridview in readonly, the button continues the same.

How i can put the button in readonly mode? This is the code.
<telerik:RadGridView x:Name="myListView" IsReadOnly="{Binding Path=pending, Converter={StaticResource booleanToInverseConv}}">
    <telerik:RadGridView.Columns>
        <telerik:GridViewColumn Header="" IsFilterable="False" HeaderCellStyle="{StaticResource estiloDaColuna}">
            <telerik:GridViewColumn.CellTemplate>
                <DataTemplate>
                    <Button Style="{DynamicResource ImageButtonStyle}" Tag="{Binding Path=id}" x:Name="btnRemoveProduto" Width="20" Click="removeProduto_Click" Height="20">
                        <Image Source="..\..\..\Icons\delete_red.png" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left" />
                    </Button>
                </DataTemplate>
            </telerik:GridViewColumn.CellTemplate>
        </telerik:GridViewColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

Second question, i want bind a business property in a column footer,
<telerik:GridViewDataColumn IsFilterable="False" IsReadOnly="True" Header="Desconto 2" DataMemberBinding="{Binding desconto2}" DataFormatString="{}{0:N2}%" Width="90" HeaderCellStyle="{StaticResource estiloDaColuna}" FooterCellStyle="{StaticResource GridViewCellStyleLeft}">
                                    <telerik:GridViewDataColumn.Footer>
                                        <StackPanel>
                                            <Label Content="Ola"></Label>
                                            <Label Content="{Binding Path=Descontos}"></Label>
                                        </StackPanel>
                                    </telerik:GridViewDataColumn.Footer>

Making that only appears the word "ola", the value in "Descontos" is not show. How can resolve it?

Thanks
Tiago
Top achievements
Rank 1
 answered on 07 May 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
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?