Telerik Forums
UI for WPF Forum
1 answer
127 views
Like many developers who are using Prism in their application, I am using a UserControl inherited from a RadPane as my view. This breaks the designer in VS (same issue in Blend for VS).

I see this issue in PITS, Creating RadPane as a UserControl breaks design time and no matter what you try to put as content it doesn't show, is marked as resolved, but there is no indication of any solution.

I can accept that it might be an issue in VS itself, rather than with the control suite. If this is the case, are there any issues on Microsoft's Connect site that I can reference? If not, and it is an issue in the Telerik controls, is there any word of a solution or workaround?
Vladi
Telerik team
 answered on 28 May 2013
2 answers
131 views
Hello,
I want to use multiple Dataset on my Telerik Editor (RichTextBox). Let me explain in steps, Firstly i created another "Insert Merge Filed" button and populate 2nd Dataset data. In the second step, drop Merge fields related to both Dataset (Insert Merge Filed and Insert Merge Filed 2) on letter and then simply save. Now problem get started when i open saved letter and wanna to view the Merge fields data on load not on click Preview results. When I put  this line of code  "this.radRichTextBox.ChangeAllFieldsDisplayMode(FieldDisplayMode.Result)"  on letter load, Merge fields related to one data set  load not other Dataset.
Here is my code 

void Page1_Loaded(object sender, RoutedEventArgs e)
 {
ds = letterservice.ExecuteTag("SearchPatient", new System.Collections.Generic.KeyValuePair<string, object>[] { new  System.Collections.Generic.KeyValuePair<string, object>("@0", 135) });
AddMergeFieldsInDropDownContent(this.btnModule, ds);                   
ds = letterservice.ExecuteTag("SearchPatientImmunization", new System.Collections.Generic.KeyValuePair<string, object>[] { new  System.Collections.Generic.KeyValuePair<string, object>("@0", 8) });
 
AddMergeFieldsInDropDownContent(this.btnSubModule, ds);
this.radRichTextBox.ChangeAllFieldsDisplayMode(FieldDisplayMode.Result);
}
 
private void AddMergeFieldsInDropDownContent(RadRibbonDropDownButton radRibbonDropDownButton, DataSet ds)
        {
            Grid grid = new Grid();
            int count = 200;
            //grid.Height = 400;
 
            ScrollViewer scrollViewer = new ScrollViewer();
            scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            StackPanel stackPanel = new StackPanel();
            //
            this.DataContext = this;
            this.radRichTextBox.Document.MailMergeDataSource.ItemsSource = ds.Tables[0].DefaultView;
 
            foreach (string fieldName in this.radRichTextBox.Document.MailMergeDataSource.GetColumnNames())
            {
                RadRibbonButton fieldButton = new RadRibbonButton
                {
                    Text = fieldName,
                    Size = ButtonSize.Medium,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                    HorizontalContentAlignment = HorizontalAlignment.Left
                };
                count++;
                fieldButton.Command = this.radRichTextBox.Commands.InsertFieldCommand;
                fieldButton.CommandParameter = new MergeField { PropertyPath = fieldName };
                stackPanel.Children.Add(fieldButton);
            }
            grid.Height = count;
            stackPanel.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            scrollViewer.Content = stackPanel;
            grid.Children.Add(scrollViewer);
            radRibbonDropDownButton.DropDownContent = grid;
        }
Petya
Telerik team
 answered on 28 May 2013
3 answers
163 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
106 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
297 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
84 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
142 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
149 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
104 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
399 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?