Telerik Forums
UI for WPF Forum
1 answer
121 views

When a property return type is ArraySegment<T> and properties are auto-generated, an exception is thrown and the control is not displayed.

My example specifically:

public class TestClass
{
    private readonly ArraySegment<string> _strings;
    public IReadOnlyList<string> Strings
    {
        get { return this._strings; }
    }
}
Maya
Telerik team
 answered on 02 Sep 2013
0 answers
101 views
Hi is there any possibility to pin RadPane from code behind? for example I have button inside radpane and after pressing the button I want to pin my RadPane

I am sorry for post I have my answer it is isPinned = false; (I had true value so It doesnt worked :D) please delete this topic :) thank you :)
Jiri
Top achievements
Rank 1
 asked on 02 Sep 2013
3 answers
211 views
In our project we want to load settings. Because of the origin of this settings structure these are very generic, exposed via wcf etc. So when we load them in our viewmodel they have the type Object. Also they consist of the real type information so we can convert them to the corresponding type. So far so good. 

When we load them in a gridview we would like to have different controls, for the different types. A Boolean should be a togglebutton, a int a numeric updown control and a string a regular textbox. For this approach we use Template selectors, but we also need to convert the types of the objects as described above. Therefore we use converters so the controls accepting the correct values and types. Until this point everything works great. We the problem arises when you scroll down in the grid. I guess you did some optimization. Therefore the templates and converters are evaluated when scrolling down. But in a different order then on initial loading. When the grid load for the first time, first the template is selected and then the converter. But when scrolling down, this order changes. To me that's a bit strange, because how can the converter be determined is there is no template. You will find sample code below. Only in our application there are binding errors showing up in the output window, in this example not. But the problem is still the same. Can we work around this issue, or need you guys to update this?

MainWindow:
<Grid>
        <Grid.Resources>
            <local:BooleanConverter x:Key="BooleanConverter" />
            <local:InvBooleanConverter x:Key="InvBooleanConverter" />
            <local:StringToIntConverter x:Key="StringToIntConverter" />
            <local:StringToDblConverter x:Key="StringToDblConverter" />
            <local:SettingValueTemplateSelector x:Key="SettingValueTemplateSelector" >
                <local:SettingValueTemplateSelector.BooleanTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <telerik:RadRadioButton IsChecked="{Binding Path=Value}">
                                <TextBlock Text="Enabled"/>
                            </telerik:RadRadioButton>
                            <telerik:RadRadioButton IsChecked="{Binding Path=Value}">
                                <TextBlock Text="Disabled"/>
                            </telerik:RadRadioButton>
                        </StackPanel>
                    </DataTemplate>
                </local:SettingValueTemplateSelector.BooleanTemplate>
                <local:SettingValueTemplateSelector.IntTemplate>
                    <DataTemplate>
                        <telerik:RadNumericUpDown Value="{Binding Path=Value, Converter={StaticResource StringToIntConverter}}" NumberDecimalDigits="0"/>
                    </DataTemplate>
                </local:SettingValueTemplateSelector.IntTemplate>
                <local:SettingValueTemplateSelector.DoubleTemplate>
                    <DataTemplate>
                        <telerik:RadNumericUpDown Value="{Binding Path=Value,Converter={StaticResource StringToDblConverter}}" />
                    </DataTemplate>
                </local:SettingValueTemplateSelector.DoubleTemplate>
                <local:SettingValueTemplateSelector.StringTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Path=Value, Mode=TwoWay}" />
                    </DataTemplate>
                </local:SettingValueTemplateSelector.StringTemplate>
            </local:SettingValueTemplateSelector>
 
        </Grid.Resources>
        <telerik:RadGridView x:Name="RadGridView" GroupRenderMode="Flat"
                             RowIndicatorVisibility="Collapsed" CanUserFreezeColumns="False"
                             ItemsSource="{Binding ElementName=Window1, Path=List}"
                             IsReadOnly="false"
                             ScrollMode="Deferred"
                             AutoExpandGroups="True"
                             AutoGenerateColumns="false" Margin="0,2,0,-2">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn
                    Header="Value"
                    IsGroupable="True"                   
                    DataMemberBinding="{Binding Value}" 
                    CellTemplateSelector="{StaticResource SettingValueTemplateSelector}"
                    Background="LightGray">
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn
                    Header="ValueType"
                    IsGroupable="True"                   
                    DataMemberBinding="{Binding ValueType}"                   
                    Background="LightGray">
                </telerik:GridViewDataColumn>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
Template selector:
public class SettingValueTemplateSelector : DataTemplateSelector
    {
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            if (item is DataObjecten)
            {
                DataObjecten model = item as DataObjecten;
 
                if (model.ValueType == typeof(int))
                    return this.IntTemplate;
                else if (model.ValueType == typeof(String))
                    return this.StringTemplate;
                else if (model.ValueType == typeof(double))
                    return this.DoubleTemplate;
                else if (model.ValueType == typeof(bool))
                    return this.BooleanTemplate;
                else
                    return null;
            }
            return null;
        }
}

One of the converters (basic):
public class StringToIntConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        int retValue=0;
        if (int.TryParse(value.ToString(), out retValue))
        {
            return retValue;
        }
        else
            return 0;
    }
 
    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
          throw new NotSupportedException("Do not use this converter for objects other than boolean");
    }
}

Model:
public class DataObject
  {
      public object Value { get; set; }
      public Type ValueType { get; set; }
  }
 
          List.Add(new DataObject() { Value = "8", ValueType = typeof(int) });
          List.Add(new DataObject() { Value = "8", ValueType = typeof(double) });
          List.Add(new DataObject() { Value = "8gf", ValueType = typeof(string) });
          List.Add(new DataObject() { Value = 454365, ValueType = typeof(int) });
          List.Add(new DataObject() { Value = false, ValueType = typeof(bool) });

Nedyalko Nikolov
Telerik team
 answered on 02 Sep 2013
1 answer
206 views
Hi,

I'm having troubles with the onMouseEnter and onMouseLeave for the RadTreeViewItems.

Each time the mouse is over an item I need to show an image ("Gear")  beside this RadTreeviewItem. I'm showing this image with the onMouseEnter event and i'm hiding it with the onMouseLeave event. The problem is when i select a RadTreeViewItem that is inside another RadTreeViewItem. It shows its "Gear" and also its father "Gear".

The event is fired by the item that got the mouseOver and by all its fathers. the event should be fired only by the item with the mouse over.

can you please advise me?

thanks



Pavel R. Pavlov
Telerik team
 answered on 02 Sep 2013
2 answers
269 views
I'm working with a RadMaskedCurrencyInput control for the first time. It's bound to a SmallMoney column in a SQL Server 2008 R2 Express database, and it's hosted in a WPF DataGrid.

First question, I've removed the underlines, by changing the Placeholder property to " ". That works fine. NOw, how do I remove the thousands separator? Right now it looks a little funny, when there's something like $86.00 in the database. It looks like this: "$ , 86.00" (without the double quotes).

Second (this is more of a question concerning the interaction between the RadMaskedCurrencyInput control and the WPF DataGrid control), how many data templates do I have to specify within the DataGridTemplateColumn? This data grid needs to be able to display data, allow the user to edit the data, delete it and insert new data; basically normal CRUD operations. In order to help I'll show you what the XAML looks like right now:

<DataGridTemplateColumn x:Name="amountEarnedColumn" Header="Amount Earned" Width="SizeToHeader">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <telerik:RadMaskedCurrencyInput Value="{Binding AmountEarned}" Mask="c5.2" Placeholder=" " />
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
    <DataGridTemplateColumn.CellEditingTemplate>
        <DataTemplate>
            <telerik:RadMaskedCurrencyInput Value="{Binding AmountEarned}" />
        </DataTemplate>
    </DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>

Third, the AmountEarned column that is bound to, is not nullable. But $0.00 is a valid value, so how do I specify a default value of $0.00 when the user creates a new row?
Pavel R. Pavlov
Telerik team
 answered on 02 Sep 2013
1 answer
270 views
I know how to get the current RadPane that is visible in a group, bur how do I make one the selected one?
Georgi
Telerik team
 answered on 02 Sep 2013
1 answer
372 views
Hi I have a problem with DateTimePicker,
I put 3 DateTimePicker on tab control one for each tabitem.
Now i bind a SelectedTime to the Same propriety for all controls.
In the first tab the DateTimePicker work fine, on second tab the DateTimePicker when lost focus not update the Correct Value.

Please can you send me a response?
Thanks.
Paolo T.
Ventzi
Telerik team
 answered on 02 Sep 2013
1 answer
162 views
Hi there !

I've downloaded the latest WPF telerik components (Q2 2013).

I'm trying to implement drag &drop between one RadGridView and one RadTreeListView with autoscroll while dragging to the drop target (RadTreeListView) but have no success.

I only find exemples with RadTreeView using RadDragAndDropManager wich seems to be obsolete....

So my questions are :
Is this possible ? natively ? could you provide a sample project ?

thanks.

Regards
Nick
Telerik team
 answered on 02 Sep 2013
1 answer
116 views

Hi,

We are using MVVM model. There are two grids parent and Child. Child Grid will be loaded on selecting any Parent row. Child grid will have all cells in Edit mode on Cell Focus and any change done to the cells will be auto saved. The task is to reload the Parent and Child grid when any concurrency exception occurs while auto saving Cells in Child grid. Below code is used to raise an Concurrency exception in viewmodel which is handled to display message box. Once the message is shown dispatcher exception is occuring.

Can you suggest any solution to avoid the Dispatcher  exception?


 

Xaml.cs
---------
private void childgrd_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)

{

viewmodel.HandleCellEditEnded(e.Cell.Column.DisplayIndex);

viewmodel.HeaderSelected = e.Cell.Column.Header.ToString();

}

viewmodel
-------------
public void HandleCellEditEnded(int Column)
{
Update();
}

public void Update()
{
try
{
  //Save child grid changes
}
catch (DbUpdateConcurrencyException)
{
  MessageBox.Show("Concurrency exception occured");
  SelectedParent = null;
  ParentGridCollection = null;               
  SelectedChild = null;
  childGridCollection = null;
  LoadParent();
}
}

Regards,
Vinetha.P

Nedyalko Nikolov
Telerik team
 answered on 02 Sep 2013
5 answers
567 views
Hi,

I have been working with the validation on my RadGridView. It works a little too well. I don't want to use cell validation but row validation is occurring with every cell edit. I would like to see something like the ValidatesOnDataErrors property contain an option for OnRowFocusLost or similar meaningful option.

I have looked around but in this case cannot seem to find a way of achieving what I want. How do you get the RadGridView to do RowValidating only when the focus is about to go to another row?

Thanks,
Rob
Maya
Telerik team
 answered on 02 Sep 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
DataPager
PersistenceFramework
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?