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

Overview:-
We are using RadMaskedNumericInput control embedded in a RadGridView Cell for allowing user to edit the existing decimal values. Also, the Foreground property of the RadMaskedNumericInput control is bound to a decimal value and a converter (named ValueToColorConvertor) is applied which turns the foreground red for negative numbers and keep it black for non-negative number.
Problem:-
Now the problem that on refreshing the data source of the GridView (in whoes cell RadMaskedNumericInput control is embedded) RadMask control's foreground behave's awkwardly and for few of the cells sometime a positive number is shown red and sometimes a negative number is shown black (see the attached snapshot)

Analysis:-
I have verified that when data is refreshed for parent RadGridView then ValueToColor foreground converter is not invoked for all the radmaskednumericInput control instances. this converter is invoked randomly for 7-8 instances out of 13 instances shown in the controls attached snapshot.

Converter and Behavior applie are :-
1) ValueToColorConverter:- converts decimal value to Red/Black colour brush during  first time load/refresh of the data.
2) TargetExposureConverter:- which is a multivalue converter to attach parameters to the RadMaskedNumericInput valuechanging command
3) RadMaskedInputValueChangingBehavior:- This behaviour changes the foreground of the RadMaskedNumericInput control's text on value changed.

 

public class ValueToColorConverter : IValueConverter

{

 

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

{

 

var brush = new SolidColorBrush(Colors.Black);

 

Double doubleValue = 0.0;

 

Double.TryParse(value.ToString(), out doubleValue);

 

if (doubleValue < 0)

brush =

 

new SolidColorBrush(Colors.Red);

 

return brush;

}

 

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

{

 

throw new NotImplementedException();

}

}


-----------------------------------------------

 

public class TargetExposureConverter : IMultiValueConverter

{

 

public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)

{

 

if (values == null)

 

return null;

 

if (values.Length != 2)

 

throw new ApplicationException("Expecting 2 parameters in TargetExposureConverter");

 

var targetExposureCmdParameter = new TargetExposureEditedCmdParam();

 

decimal value;

 

decimal.TryParse(System.Convert.ToString(values[0]), out value);

targetExposureCmdParameter.TargetExposure = value;

 

var targetExposureCell = values[1] as GridViewCell;

 

if (targetExposureCell != null && targetExposureCell.ParentRow != null)

{

targetExposureCmdParameter.CurrentRow = targetExposureCell.ParentRow.Item

 

as CcyExposureCurrencySummary;

}

 

return targetExposureCmdParameter;

}

 

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)

{

 

throw new NotImplementedException();

}

}


-----------------------------------

 

public class RadMaskedInputValueChangingBehavior : Behavior<RadMaskedInputBase>

{

 

protected override void OnAttached()

{

 

base.OnAttached();

AssociatedObject.ValueChanging += OnValueChanging;

}

 

protected override void OnDetaching()

{

 

base.OnDetaching();

AssociatedObject.ValueChanging -= OnValueChanging;

}

 

void OnValueChanging(object sender, RadMaskedInputValueChangingEventArgs e)

{

 

var maskedInputControl = sender as RadMaskedNumericInput;

 

if (maskedInputControl == null)

 

return;

 

if (e.NewValue == null)

 

return;

 

double newVal;

 

if (!double.TryParse(Convert.ToString(e.NewValue), out newVal))

 

return;

maskedInputControl.Foreground = newVal < 0

?

 

Brushes.Red

:

 

Brushes.Black;

}

}

Petar Mladenov
Telerik team
 answered on 28 May 2013
2 answers
109 views
Hi,

I want to be able to handle key events on the GridView that will flip a GridViewColumn between view mode and edit mode programmatically. How do I do this?

Thanks, Sterren
Sterren
Top achievements
Rank 1
 answered on 28 May 2013
1 answer
305 views
Hello,
When we use template to decorate the Title/Header and its working fine as long as the pane doesn't gets detached.  The moment the radpane gets detached manually, the title/header disappears.  Radpane's are loading dynamically through the config file arrangements.  The header template is defined in the resource file and leveraged using properties defined.

Your help is highly appreciated!
Thanks in advance!
-Raj
Kalin
Telerik team
 answered on 28 May 2013
3 answers
86 views
Hi,

I'm trying to style the scroll bar that allows the user to scroll through the "smallcontent" tiles.  There's a scrollview within the LargeContent tile view and that one picks up the general Scrollbar style properly.  How can I access the scrollbar (marked as "Not picking up style" in the attached image) style?

I added a screen shot showing the styled scrollbar and the one I can't style.

Thanks,

Joel
Pavel R. Pavlov
Telerik team
 answered on 28 May 2013
1 answer
152 views
This is probably simple to do I just can't find it in the help.

I want my y axis values to range from largest to smallest instead of small to large. This should display the bar with the lowest number as the longest bar and the bar in the chart with the highest number as the shortest bar in the chart.

Thank You,
Mark
Petar Kirov
Telerik team
 answered on 27 May 2013
2 answers
152 views
Hi everyone,

I'm using PRISM with MEF for modularity with RadDocking Telerik component to display my views into dock.

On my application, I have a Shell with a dockmenu on the left, and a documenthost on the center, here is the Shell.xaml :
<telerik:RadDocking PreviewClose="RadDocking_PreviewClose" x:Name="dock">
    <telerik:RadDocking.DocumentHost>
        <telerik:RadSplitContainer >
            <telerik:RadPaneGroup prism:RegionManager.RegionName="{x:Static const:RegionConstants.CentralRegionName}" x:Name="centralGroup"  />
        </telerik:RadSplitContainer>
    </telerik:RadDocking.DocumentHost>
 
    <telerik:RadSplitContainer x:Name="leftContainer" InitialPosition="DockedLeft">
        <!-- Menu -->
        <telerik:RadPaneGroup x:Name="MenuGroup">
            <telerik:RadPane x:Name="MenuPanel" Header="Menu" CanUserClose="False">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
 
                    <telerik:RadTreeView x:Name="principalMenuTreeView" Grid.Row="1"
                                         VerticalAlignment="Stretch"
                                         IsLineEnabled="True" ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                         SelectionMode="Single" IsEditable="False" IsDragDropEnabled="True">
                        <telerik:RadTreeViewItem Header="Monitoring" IsExpanded="True">
                            <telerik:RadTreeViewItem Header="All Customers"
                                                     Command="{Binding LoadViewCommand}"
                                                     CommandParameter="{x:Static const:ViewConstants.AllCustomersView}" />
                        </telerik:RadTreeViewItem>
 
                    </telerik:RadTreeView>
                </Grid>
            </telerik:RadPane>
        </telerik:RadPaneGroup>
    </telerik:RadSplitContainer>
</telerik:RadDocking>


I'm using a command in my ShellViewModel to add view in the DocumentHost region, it works correctly :
private void DisplayViewCommand(object viewName)
{
    IRegion region = this.regionManager.Regions[RegionConstants.CentralRegionName];
 
    object view = null;
    switch (viewName as string)
    {
        case ViewConstants.AllCustomersView:
            view = ServiceLocator.Current.GetInstance<AllCustomersView>();
            break;
        default:
            break;
    }
 
    if (region.Views.Contains(view))
    {
        region.Remove(view);
    }
 
    region.Add(view);
    region.Activate(view);
}


I overrided the close panel button to remove the view from the Region, it works too (Shell.xaml.cs) :

private void RadDocking_PreviewClose(object sender, StateChangeEventArgs e)
{
    if (e.Panes != null && e.Panes.Count() > 0)
    {
        RadPane toDelete = e.Panes.FirstOrDefault();
        IRegion mainRegion = this.regionManager.Regions[RegionConstants.CentralRegionName];
 
        if (mainRegion.Views.Contains(toDelete))
        {
            mainRegion.Remove(toDelete);
        }
    }
 
    e.Handled = true;
}


But, when I drag this pane out of that group (to make it float), and I try to launch the command to load the view again, it prompt me an error in the RadPaneGroupRegionAdapter.cs, on the line "regionTarget.Items.Add(view);"  :

Element already has a logical parent. It must be detached from the old parent before it is attached to a new one.
case NotifyCollectionChangedAction.Reset:
    regionTarget
                .EnumeratePanes()
                .ToList()
                .ForEach(p => p.RemoveFromParent());
    foreach (object view in region.Views)
    {
        regionTarget.Items.Add(view); /!\ On this line, the exception occurs
    }
    break;

Maybe I forgot something ?
In advance, thanks for your help.

Regards,
Guillaume
Guillaume
Top achievements
Rank 1
 answered on 27 May 2013
0 answers
106 views
Hi,

How can i please add a StyleRule's condition to set the IsExpandable property when the row has no chids rows.
I'm looking for a condition like 'row.count > 0'. I'm using MVVM and dont want to put a code behind.
Many thanks ;)
Youness
Top achievements
Rank 1
 asked on 27 May 2013
2 answers
413 views
I am looking for a sample of using Data triggers in cell style with auto commit

,something like the below style(not working)

Whenever user press a key inside the editor,i would like that the trigger will evaluate the current text

< Style x:Key="LengthStyle" TargetType="telerik:GridViewCell" BasedOn="{GridViewCellStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsValidLength}" Value="False">
<Setter Property="Background" Value="red" />
</DataTrigger>
<DataTrigger Binding="{Binding IsValidLength}" Value="True">
<Setter Property="Background" Value="green" />
</DataTrigger>
</Style.Triggers>
</Style>

Thanks in advance
Dimitrina
Telerik team
 answered on 27 May 2013
2 answers
122 views
HI

I've cobbled together a custom region adapter from reading lots of threads on here, and everything works fine.

However, I've come up against a problem that I'm sure someone must've seen.

The regions are set on a RadPaneGroup level.  You add your view to a specific region and everything's great.

If the user then drags this pane out of that group, then the view is no longer in that region.  If they make the view floating, then it's no longer in any defined region - so how so I remove it using the RegionManager?

Any thoughs appreciated!

Charlie
Guillaume
Top achievements
Rank 1
 answered on 27 May 2013
1 answer
237 views
Since last update,
my RadRibbonButtons are resetting Size to small.

                <telerik:RadRibbonGroup>
                    <telerik:RadButtonGroup>
                        <telerik:RadRibbonButton Size="Large" LargeImage="/Ressourcen;component/Resources/Delete.png"/>
                    </telerik:RadButtonGroup>
                        
                </telerik:RadRibbonGroup>

set the Size in xaml.
Start program and close
Then the size in designer is set to small
Kiril Vandov
Telerik team
 answered on 27 May 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
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
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
VirtualKeyboard
HighlightTextBlock
Security
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?