Telerik Forums
UI for WPF Forum
1 answer
181 views
I have a reference in my xaml as such:
xmlns:maskedInput="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input"

I am trying to set the Minimum value in the style as such:
        <Style x:Key="RadMaskedCurrencyInputStyle" TargetType="telerik:RadMaskedCurrencyInput">
            <Setter Property="maskedInput:MaskedInputExtensions.Minimum" Value="0" />
        </Style>

This throws an exception at run time:  
System.Windows.Markup.XamlParseException occurred
  Message='Set property 'System.Windows.Setter.Property' threw an exception.' Line number '10' and line position '14'.
  Source=PresentationFramework
  LineNumber=10
  LinePosition=14
  StackTrace:
       at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
       at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
       at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
       at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
       at TestRadControl.MainWindow.InitializeComponent() in ...\Documents\Visual Studio 2010\Projects\TestRadControl\TestRadControl\MainWindow.xaml:line 1
       at TestRadControl.MainWindow..ctor() in ...2010\Projects\TestRadControl\TestRadControl\MainWindow.xaml.cs:line 25
  InnerException: System.ArgumentNullException
       Message=Value cannot be null.
Parameter name: property
       Source=PresentationFramework
       ParamName=property
       StackTrace:
            at System.Windows.Setter.CheckValidProperty(DependencyProperty property)
            at System.Windows.Baml2006.WpfSharedBamlSchemaContext.<Create_BamlProperty_Setter_Property>b__1c0(Object target, Object value)
            at System.Windows.Baml2006.WpfKnownMemberInvoker.SetValue(Object instance, Object value)
            at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(XamlMember member, Object obj, Object value)
            at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)
       InnerException: 


Is this a flaw with Telerik's implementation of the Minimum dependency property?  I am using version 2011 SP1.

Thanks,
Monica
Tina Stancheva
Telerik team
 answered on 18 May 2012
1 answer
110 views
Hello,

I have my application in "pt-PT" culture, and have this column.

<telerik:GridViewDataColumn IsSortable="False" IsFilterable="False" Header="Preço Unitário" DataMemberBinding="{Binding PrecoUnitario}"
DataFormatString="{}{0:C}" MinWidth="60" MaxWidth="100" HeaderCellStyle="{StaticResource estiloDaColuna}"/>

introducing "20.2", it places "202,00".
introducing "20,2" it places "20,20".

In "en-US" culture works well.

So, how can i give the same behavior for dot and comma?

Thanks
Dimitrina
Telerik team
 answered on 18 May 2012
0 answers
131 views
Hi,
I need a sample code for to create the parent and child grid.
Regards
Rajini
Rajini
Top achievements
Rank 1
 asked on 18 May 2012
0 answers
100 views
Here is a code sample that gets the Type Of the Next & Previous Annotation at the caret position.
.
Get TypeOf Next Annotation:
public static AnnotationRangeMarkerBase GetNextAnnotationMarker(this RadDocument document)
{
    if (!document.Selection.IsEmpty)
    {
        document.CaretPosition.MoveToPosition(document.Selection.Ranges.Last.EndPosition);
    }
 
    InlineLayoutBox inlineLayoutBox = document.CaretPosition.GetCurrentInlineBox();
    while (inlineLayoutBox != null && !(inlineLayoutBox.AssociatedInline is AnnotationRangeMarkerBase))
    {
        inlineLayoutBox = (InlineLayoutBox)DocumentStructureCollection.GetNextElementOfType(inlineLayoutBox, typeof(AnnotationMarkerLayoutBox));
    }
 
    if (inlineLayoutBox == null)
    {
        return null;
    }
 
 
    AnnotationRangeMarkerBase annotationMarker = inlineLayoutBox.AssociatedInline as AnnotationRangeMarkerBase;
    if (annotationMarker == null)
    {
        return null;
    }
 
    return annotationMarker;
}


Get TypeOf Previous Annotation:
public static AnnotationRangeMarkerBase GetPreviousAnnotationMarker(this RadDocument document)
{
    if (!document.Selection.IsEmpty)
    {
        document.CaretPosition.MoveToPosition(document.Selection.Ranges.Last.StartPosition);
    }
 
    InlineLayoutBox inlineLayoutBox = document.CaretPosition.GetCurrentInlineBox();
    do
    {
        inlineLayoutBox = (InlineLayoutBox)DocumentStructureCollection.GetPreviousElementOfType(inlineLayoutBox, typeof(AnnotationMarkerLayoutBox));
    }
    while (inlineLayoutBox != null && !(inlineLayoutBox.AssociatedInline is AnnotationRangeStart));
 
    if (inlineLayoutBox == null)
    {
        return null;
    }
 
    return inlineLayoutBox.AssociatedInline as AnnotationRangeMarkerBase;
}


This is how you can use the methods:
//Get the previous annotation type
AnnotationRangeMarkerBase previousAnnotationType = RadDocumentExtensions.GetPreviousAnnotationMarker(radRichTextBox.Document);
 
 
//Get the next annotation type
AnnotationRangeMarkerBase nextAnnotationType = RadDocumentExtensions.GetNextAnnotationMarker(radRichTextBox.Document);

I hope this help you as it did me.

p.s. This code was mostly given to me by the Telerik support team via a ticket that I sent.
Robert
Top achievements
Rank 1
 asked on 18 May 2012
1 answer
186 views
I have a column in my RadGridView that displays some text and then also contains a button that should only be visible to users with permission to change the data.  I'm using MVVM and the viewmodel exposes a boolean property named UserHasWriteAccess that indicates the user's permission level.  The column and its datatemplate are defined as follows.

<telerik:GridViewDataColumn Header="Reason Code">
    <telerik:GridViewDataColumn.CellTemplate>
        <DataTemplate>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
 
                <TextBlock Text="Lorem ipsum" />
                <Button Content="Edit"
                        Height="23"
                        HorizontalAlignment="Right"
                        Margin="4,0,0,0"
                        Visibility="{Binding DataContext.UserHasWriteAccess,
                                    Mode=OneTime,
                                    Converter={StaticResource BooleanToVisibilityConverter},
                                    RelativeSource={RelativeSource AncestorType=telerik:RadGridView}}">
            </Grid>
        </DataTemplate>
    </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>

When UserHasWriteAccess is false, the button's visibility binding works fine most of the time (~99%) and the button does not show.  However, as the user scrolls up and down through the grid, eventually intermittent binding errors will suddenly appear for a row or two for which the binding worked previously.  Sometimes the user has to scroll up and down several times before it happens.  Other times it's immediate.  The errors say:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Telerik.Windows.Controls.RadGridView', AncestorLevel='1''. BindingExpression:Path=DataContext.UserHasWriteAccess; DataItem=null; target element is 'Button' (Name=''); target property is 'Visibility' (type 'Visibility')

Curiously, when I inspect an errored binding using Snoop, it suddenly works again.

Is there a known issue with ancestor binding in RadGridView?
Pavel Pavlov
Telerik team
 answered on 18 May 2012
1 answer
363 views
Hello!

We are using MVVM pattern to build our application. One of our views uses number of NumericUpDown controls. If text of some NumericUpDown is set to empty string by user control displays red frame (see screenshot "validation error"). Property definition you can find in screenshot named "amount property".

The problem is that view model is not updated when text is empty and red frame is displayed. E.g. model still contains previous value.

What is correct way to notify View Model about missing data? Keep in mind that we have significant number of views and each contains set of numeric controls.
Georgi
Telerik team
 answered on 18 May 2012
0 answers
194 views
We have a WPF app which uses RadGrid. As part of the app functionality, we want the grid selection unit to always be of type "row". In addition to this, we also want to expose a mechanism where the user can select a cell value for copy/paste to clipboard. Is there a way to do this? For example, double clicking a cell copies the cell value where as single click always selects the row. Or right click on cell exposes the option to "Copy cell" value? 

Thanks!

H
Top achievements
Rank 1
 asked on 18 May 2012
1 answer
82 views
Does the wpf GridView support direct binding to SqlCeResultSet?
Vlad
Telerik team
 answered on 18 May 2012
1 answer
240 views
Hi,

I'm using RadControls for WPF (version 2012.1.326.40), and my question is about the RadTreeView.
Is it possible to show an overlay image over the RadTreeViewItem's DefaultImageSrc ?

Best regards,
Petar Mladenov
Telerik team
 answered on 18 May 2012
3 answers
335 views
Hi All,

Edit: The title should state that the issue is with ListView items and not ListBox items. Cannot change it now - sorry about the confusion.

I am trying to put a context menu on items in a ListView when that ListView is contained within a RadPanelBarItem that has a context menu. I hope the code example below illustrates what I am trying to do. If I don't add the following then the list items show the expected menu.

<telerik:RadContextMenu.ContextMenu>
     <telerik:RadContextMenu x:Name="_macroActionContextMenu" />
 </telerik:RadContextMenu.ContextMenu>

When I add it (as shown in the snippet below) then I always get the context menu associated with the RadPanelBarItem when I right click on the ListView elements rather than the context menu specified for the ListView.ItemContainerStyle.

Any help would be appreciated. My code snippet is below.

        <telerik:RadPanelBarItem Name="_rpbiMacros" Header="Macros" IsDropAllowed="False" Foreground="#FF4D4D4D" BorderBrush="#FFBCB596" >
            <telerik:RadContextMenu.ContextMenu>
                <telerik:RadContextMenu x:Name="_macroActionContextMenu" />
            </telerik:RadContextMenu.ContextMenu>
            <!--Constrain the size of the wrap panel so it can do its thing-->
            <Grid Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadPanelBar}}, Path=ActualWidth, Converter={StaticResource mathConverter}, ConverterParameter=@VALUE-12;0}">
 
                <!-- View as icons -->
 
                <WrapPanel Name="_wrpMacroActions"
                    Visibility="{Binding ViewMacroActionListAsIcons, Converter={StaticResource boolToVisibilityConverter}, ConverterParameter=Visibility.Collapsed}">
                    <ItemsControl ItemsSource="{Binding MacroActionViewModelList}" >
 
... omitted for clarity
 
                    </ItemsControl>
                </WrapPanel>
 
                <!-- View as list -->
 
                <ListView x:Name="_lviewMacroActions" ItemsSource="{Binding MacroActionViewModelList}" ButtonBase.Click="OnClick_ListViewHeader"
                    Visibility="{Binding ViewMacroActionListAsIcons, Converter={StaticResource invertBoolToVisibilityConverter}, ConverterParameter=Visibility.Collapsed}" >
                    <ListView.Resources>
                        <ContextMenu x:Key="itemContextMenu">
                            <MenuItem Header="Open" Click="OnClick_EditMacroAction">
                            </MenuItem>
                            <MenuItem Header="Delete" Click="OnClick_DeleteMacroAction" >
                                <MenuItem.Icon>
                                    <ContentControl Template="{StaticResource _rscDeleteImage}" />
                                </MenuItem.Icon>
                            </MenuItem>
                        </ContextMenu>
                    </ListView.Resources>
                    <ListView.ItemContainerStyle>
                        <Style TargetType="{x:Type ListViewItem}">
                            <Setter Property="telerik:RadContextMenu.ContextMenu" Value="{StaticResource itemContextMenu}" />
                            <EventSetter Event="MouseDoubleClick" Handler="OnDoubleClick_MacroAction" />
                        </Style>
                    </ListView.ItemContainerStyle>
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Model.MacroName}"/>
                            <GridViewColumn Header="Description" DisplayMemberBinding="{Binding Model.MacroDescription}" />
                        </GridView>
                    </ListView.View>
                </ListView>
 
            </Grid>
        </telerik:RadPanelBarItem>

x
Scott
Top achievements
Rank 1
 answered on 17 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
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?