Telerik Forums
UI for WPF Forum
1 answer
94 views
Hi,
I want to display the value of pie sector in the legend item along with the description.
For reference i have also attached a screen shot.

Thanks
Dhruv
Petar Marchev
Telerik team
 answered on 10 Apr 2012
14 answers
1.0K+ views
Hi,

I have an application with multiple RadWindow and RadWindow.Alert. Some of them are in my project and the orther are in other project (DLL) associated to my application. I like to know how I can disable RadWindow/RadWindow.Alert animation for all my application and related DLL's?

PS: Are the persistence can take care of it if I disable the animation???

Thank's
Ivo
Telerik team
 answered on 10 Apr 2012
5 answers
442 views
I want to put text in the GridView Row header, similar to MS Excel, where it puts numbers 1, 2, 3...... I want to put some custom text. Can you tell me how can this be done?

Thanks,

Ujjwal
Mohammad
Top achievements
Rank 1
 answered on 10 Apr 2012
4 answers
2.0K+ views
Hi,

I have a RadGridView that gets bound to a DataTable (aside: this may not be the proper way to bind, but the UserControl is passed _wg) with this line:
rgvGrid.ItemsSource = _wg.GridData.Tables[0];
One of the columns has a string that I'd like to show an image dependant on what the string is. A job for a converter I thought...
My Converter class is (I've taken out the case statements to ensure an image is returned):
public class RequestColumnConverter : IValueConverter
{
    public object Convert(object value, Type targetType,
        object parameter, CultureInfo culture)
    {
        if (value != null)
        {
            string name = (string)value;
 
            var requestImage = new Image()
            {
                Height = 16,
                Width = 16,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
            };
 
            requestImage.Source = new BitmapImage(new Uri("pack://application:,,,/Images/service.png"));
            return requestImage;
        }
        else return null;
    }
 
    public object ConvertBack(object value, Type targetType,
        object parameter, CultureInfo culture)
    {
        return null;
    }
}

My xaml file contains:
<telerik:GridViewDataColumn Header="Type" IsReadOnly="True" UniqueName="SCSRequestTypeName" DataMemberBinding="{Binding Path=SCSRequestTypeName, Converter={StaticResource requestColumnConverter}}">
     <telerik:GridViewDataColumn.CellTemplate>
             <DataTemplate>
                <Image Source="{Binding SCSRequestTypeName, Converter={StaticResource requestColumnConverter}}"/>
            </DataTemplate>
     </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
This doesn't work. When I add the converter to DataMemberBinding (as shown above), the program enters the converter, but it doesn't enter the converter if I simply have it listed in the Image Source line (also shown).

Have you any suggestions how to get this to work?

Thanks
Vlad
Telerik team
 answered on 10 Apr 2012
0 answers
326 views
Hi
I'm using prism and MVVM architecture for my WPF application and I have a problem with RaisePropertyChanged,I have a gridview in my view that its itemsource is binded to an ObservableCollection named AllOrderProducts in my viewmodel,the problem is that when I change AllOrderProducts and i use this.RaisePropertyChanged(() => this.AllOrderProducts);
 in doesn't refresh the gridview in my view, and I have this problem with other fields or properties in my viewmodel when I use RaisePropertyChanged


can anyone help me with this problem plzz????
M
Top achievements
Rank 1
 asked on 10 Apr 2012
1 answer
205 views
I've built a User Control that contains a RadMaskedNumericInputControl in it and 2 RepeatButtons, for use in a touch screen application. My problem is that putting the cursor into the RadMaskedNumberInputControl and typing does not change to value of the control. I can type all I want & it only lets me insert valid characters. But never does the Value property change.

What am I doing wrong? Here's the xaml for the control:

<UserControl x:Class="CarSystem.CustomControls.NumberSpinner"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:cs="clr-namespace:CarSystem.CustomControls"
             mc:Ignorable="d"
             Focusable="True"
             Loaded="UserControl_Loaded">
  
    <Grid Background="{Binding Path=GridBackground, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}" 
          Width="{Binding Path=Width, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <telerik:RadMaskedNumericInput BorderBrush="{Binding Path=BorderBrush, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}"
                                       FlowDirection="{Binding Path=FlowDirection, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}"
                                       Focusable="True"
                                       FontFamily="{Binding Path=FontFamily, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}"
                                       FontSize="{Binding Path=FontSize, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}"
                                       FontStretch="{Binding Path=FontStretch, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}"
                                       FontStyle="{Binding Path=FontStyle, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}"
                                       FontWeight="{Binding Path=FontWeight, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}"
                                       GotFocus="ValueBox_GotFocus"
                                       Grid.Column="0"
                                       HorizontalAlignment="Stretch"
                                       HorizontalContentAlignment="Right"
                                       InputBehavior="Insert"
                                       IsClearButtonVisible="False"
                                       LostFocus="ValueBox_LostFocus"
                                       Margin="5"
                                       Mask="{Binding Path=Mask, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}"
                                       Name="ValueBox"
                                       SelectionOnFocus="CaretToEnd"
                                       SpinMode="PositionAndValue"
                                       TabIndex="{Binding Path=TabIndex, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}"
                                       TextMode="PlainText"
                                       UpdateValueEvent="PropertyChanged"
                                       Value="{Binding Path=Value, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}"
                                       VerticalAlignment="Center" />
        <RepeatButton Background="{DynamicResource ButtonBackground}"
                      Click="IncrementButton_Click"
                      Focusable="False"
                      Foreground="{DynamicResource ButtonForeground}"
                      Grid.Column="1"
                      IsTabStop="False"
                      Name="IncrementButton">
            <Image>
                <Image.Style>
                    <Style TargetType="{x:Type Image}">
                        <Setter Property="Source"
                                Value="/CustomControls;component/Resources/VolumeUpDay.png" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}"
                                         Value="NightTime">
                                <Setter Property="Source"
                                        Value="/CustomControls;component/Resources/VolumeUpNight.png" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Image.Style>
            </Image>
        </RepeatButton>
        <RepeatButton Background="{DynamicResource ButtonBackground}"
                      Click="DecrementButton_Click"
                      Focusable="False"
                      Foreground="{DynamicResource ButtonForeground}"
                      Grid.Column="2"
                      IsTabStop="False"
                      Name="DecrementButton">
            <Image>
                <Image.Style>
                    <Style TargetType="{x:Type Image}">
                        <Setter Property="Source"
                                Value="/CustomControls;component/Resources/VolumeDnDay.png" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:NumberSpinner}}}"
                                         Value="NightTime">
                                <Setter Property="Source"
                                        Value="/CustomControls;component/Resources/VolumeDnNight.png" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Image.Style>
            </Image>
        </RepeatButton>
    </Grid>
      
</UserControl>

Here's the code behind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
  
namespace CarSystem.CustomControls {
  
    public partial class NumberSpinner : UserControl {
        public static readonly DependencyProperty FocusedBackgroundProperty =
            DependencyProperty.Register( "FocusedBackground", typeof( Brush ), typeof( NumberSpinner ), new PropertyMetadata( null ) );
  
        public static readonly DependencyProperty FocusedForegroundProperty =
            DependencyProperty.Register( "FocusedForeground", typeof( Brush ), typeof( NumberSpinner ), new PropertyMetadata( null ) );
  
        public static DependencyProperty GridBackgroundProperty =
            DependencyProperty.Register( "GridBackground", typeof( Brush ), typeof( NumberSpinner ), new PropertyMetadata( Brushes.Transparent ) );
  
        public static readonly DependencyProperty IncrementProperty =
            DependencyProperty.Register( "Increment", typeof( double ), typeof( NumberSpinner ), new PropertyMetadata( 1.0 ) );
                  
        public static readonly DependencyProperty MaskProperty = 
            DependencyProperty.Register( "Mask", typeof( string ), typeof( NumberSpinner ), new PropertyMetadata( "#9.2" ) );
  
        public static readonly DependencyProperty MaximumProperty =
            DependencyProperty.Register( "Maximum", typeof( double ), typeof( NumberSpinner ), 
                                         new PropertyMetadata( double.NaN, new PropertyChangedCallback( OnMaximumInvalidated ) ) );
  
        public static readonly DependencyProperty MinimumProperty =
            DependencyProperty.Register( "Minimum", typeof( double ), typeof( NumberSpinner ),
                                         new PropertyMetadata( double.NaN, new PropertyChangedCallback( OnMinimumInvalidated ) ) );
  
        public static readonly DependencyProperty TimeOfDayModeProperty =
            DependencyProperty.Register( "TimeOfDayMode", typeof( TimesOfDay ), typeof( NumberSpinner ),
                                         new FrameworkPropertyMetadata( TimesOfDay.DayTime,
                                             FrameworkPropertyMetadataOptions.AffectsRender,
                                             new PropertyChangedCallback( OnTimeOfDayInvalidated ) ) );
  
        public static readonly DependencyProperty UnfocusedBackgroundProperty =
            DependencyProperty.Register( "UnfocusedBackground", typeof( Brush ), typeof( NumberSpinner ), new PropertyMetadata( null ) );
  
        public static readonly DependencyProperty UnfocusedForegroundProperty =
            DependencyProperty.Register( "UnfocusedForeground", typeof( Brush ), typeof( NumberSpinner ), new PropertyMetadata( null ) );
  
        public static readonly DependencyProperty ValueProperty = 
            DependencyProperty.Register( "Value", typeof( double ), typeof( NumberSpinner ), 
                                         new PropertyMetadata( 0.0, new PropertyChangedCallback( OnValueInvalidated ) ) );
  
        public Brush FocusedBackground {
            get { return (Brush) GetValue( FocusedBackgroundProperty ); }
            set { SetValue( FocusedBackgroundProperty, value ); }
        }
  
        public Brush FocusedForeground {
            get { return (Brush) GetValue( FocusedForegroundProperty ); }
            set { SetValue( FocusedForegroundProperty, value ); }
        }
  
        public Brush GridBackground {
            get { return (Brush) GetValue( GridBackgroundProperty ); }
            set { SetValue( GridBackgroundProperty, value ); }
        }
  
        public double Increment {
            get { return (double) GetValue( IncrementProperty ); }
            set { SetValue( IncrementProperty, value ); }
        }
  
        public string Mask {
            get { return (string) GetValue( MaskProperty ); }
            set { SetValue( MaskProperty, value ); }
        }
  
        public double Maximum {
            get { return (double) GetValue( MaximumProperty ); }
            set { SetValue( MaximumProperty, value ); }
        }
  
        public double Minimum {
            get { return (double) GetValue( MinimumProperty ); }
            set { SetValue( MinimumProperty, value ); }
        }
  
        public TimesOfDay TimeOfDayMode {
            get { return (TimesOfDay) GetValue( TimeOfDayModeProperty ); }
            set { SetValue( TimeOfDayModeProperty, value ); }
        }
  
        public Brush UnfocusedBackground {
            get { return (Brush) GetValue( UnfocusedBackgroundProperty ); }
            set { SetValue( UnfocusedBackgroundProperty, value ); }
        }
  
        public Brush UnfocusedForeground {
            get { return (Brush) GetValue( UnfocusedForegroundProperty ); }
            set { SetValue( UnfocusedForegroundProperty, value ); }
        }
  
        public double Value {
            get { return (double) GetValue( ValueProperty ); }
            set { SetValue( ValueProperty, value ); }
        }
  
        public NumberSpinner() {
            InitializeComponent();
        }
  
        private void DecrementButton_Click( object sender, RoutedEventArgs e ) {
            Value -= Increment;
        }
  
        private void IncrementButton_Click( object sender, RoutedEventArgs e ) {
            Value += Increment;
        }
  
        private void OnMaximumChanged( double newMaximum ) {
            if ( !double.IsNaN( newMaximum ) ) {
                if ( Value > newMaximum ) {
                    Value = newMaximum;
                }
                IncrementButton.IsEnabled = Value < newMaximum;
            }
        }
  
        private static void OnMaximumInvalidated( DependencyObject d, DependencyPropertyChangedEventArgs e ) {
            NumberSpinner spinner = d as NumberSpinner;
            spinner.OnMaximumChanged( (double) e.NewValue );
        }
        private void OnMinimumChanged( double newMinimum ) {
            if ( !double.IsNaN( newMinimum ) ) {
                if ( Value < newMinimum ) {
                    Value = newMinimum;
                }
                DecrementButton.IsEnabled = Value > newMinimum;
            }
        }
  
        private static void OnMinimumInvalidated( DependencyObject d, DependencyPropertyChangedEventArgs e ) {
            NumberSpinner spinner = d as NumberSpinner;
            spinner.OnMinimumChanged( (double) e.NewValue );
        }
  
        private void OnTimeOfDayModeChanged( TimesOfDay newTimeofDayMode ) {
            if ( FocusedBackground != null && UnfocusedBackground != null ) {
                ValueBox.Background = ValueBox.IsFocused ? FocusedBackground : UnfocusedBackground;
            }
            if ( FocusedForeground != null && UnfocusedForeground != null ) {
                ValueBox.Foreground = ValueBox.IsFocused ? FocusedForeground : UnfocusedForeground;
            }
        }
  
        private static void OnTimeOfDayInvalidated( DependencyObject d, DependencyPropertyChangedEventArgs e ) {
            NumberSpinner spinner = (NumberSpinner) d;
            spinner.OnTimeOfDayModeChanged( (TimesOfDay) e.NewValue );
        }
  
        private void OnValueChanged( double newValue ) {
            if ( ! double.IsNaN( Minimum ) ) {
                if ( newValue < Minimum ) {
                    Value = Minimum;
                }
                DecrementButton.IsEnabled = Value > Minimum;
            }
  
            if ( ! double.IsNaN( Maximum ) ) {
                if ( Value > Maximum ) {
                    Value = Maximum;
                }
  
                IncrementButton.IsEnabled = Value < Maximum;
            }
        }
  
        private static void OnValueInvalidated( DependencyObject d, DependencyPropertyChangedEventArgs e ) {
            NumberSpinner spinner = d as NumberSpinner;
            spinner.OnValueChanged( (double) e.NewValue );
        }
        private void UserControl_Loaded( object sender, RoutedEventArgs e ) {
            if ( FocusedBackground == null && UnfocusedBackground == null ) {
                ValueBox.Background = Background;
            }
  
            if ( FocusedForeground == null && UnfocusedForeground == null ) {
                ValueBox.Foreground = Foreground;
            }
        }
  
        private void ValueBox_GotFocus( object sender, RoutedEventArgs e ) {
            if ( FocusedBackground != null ) {
                ValueBox.Background = FocusedBackground;
            }
  
            if ( FocusedForeground != null ) {
                ValueBox.Foreground = FocusedForeground;
            }
        }
  
        private void ValueBox_LostFocus( object sender, RoutedEventArgs e ) {
            if ( UnfocusedBackground != null ) {
                ValueBox.Background = UnfocusedBackground;
            }
  
            if ( UnfocusedForeground != null ) {
                ValueBox.Foreground = UnfocusedForeground;
            }
        }
    }
}
Tina Stancheva
Telerik team
 answered on 09 Apr 2012
1 answer
70 views
Hi,

In the latest internal build, there are no themes in the folder Themes.Implicit - the only folder that has any themes is the deeply buried one with the ReportViewer themes.

Thank goodness for the Recycle Bin !!

Regards
Jeremy
Hristo
Telerik team
 answered on 09 Apr 2012
1 answer
130 views
Dear Telerik;

Document.LayoutMode = DocumentLayoutMode.Paged
I am using CTRL+N shortcut for new document. 
I am getting a strange this error.

But, Document.LayoutMode = DocumentLayoutMode.Flow
No error.

System.NullReferenceException was unhandled
  Message=Object reference not set to an instance of an object.
  Source=Telerik.Windows.Documents
  StackTrace:
       at Telerik.Windows.Documents.UI.DocumentPrintLayoutPresenter.GetFocusedPresenter() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\DocumentPrintLayoutPresenter.cs:line 687
       at Telerik.Windows.Documents.UI.DocumentPrintLayoutPresenter.get_IsFocused() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\DocumentPrintLayoutPresenter.cs:line 374
       at Telerik.Windows.Documents.UI.DocumentPrintLayoutPresenter.SetCaretBlinking(Boolean isBlinking) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\DocumentPrintLayoutPresenter.cs:line 282
       at Telerik.Windows.Documents.UI.DocumentPresenterBase.<this_KeyDown>b__0() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Documents\Core\UI\DocumentPresenterBase.cs:line 652
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

   
Thank You.

 
Iva Toteva
Telerik team
 answered on 09 Apr 2012
1 answer
148 views
How can I show several LineSeries in RadChartView, if my serieses has different diapasone on Y-axes and I want to show one obove other. I thought to create axis for each LineSeries, but I need to do it from the code. I didn't find way to do it from the code. Is there easy way to solve this problem and to do it from the code(not XAML)? 
Tsvetie
Telerik team
 answered on 09 Apr 2012
3 answers
231 views
Hello!
I try get path to image which is inserted to RadRichTextBox (with help RadRichTextBoxRibbonUI). I need local path on my computer.

i try it:
HtmlFormatProvider fp = new HtmlFormatProvider();
fp.ExportSettings = new HtmlExportSettings
{
        StylesExportMode = StylesExportMode.Inline,
        DocumentExportLevel = DocumentExportLevel.Fragment,
        ExportStyleMetadata = false,
        ImageExportMode = ImageExportMode.ImageExportingEvent
};
 
fp.ExportSettings.ImageExporting += OnImageExporting;
string html = fp.Export(editor.Document);
.....
private void OnImageExporting(object sender, ImageExportingEventArgs e)
{
        string path = e.Image.UriSource.AbsoluteUri;
}

But e.Image.UriSource is null.

And I try it:
HtmlFormatProvider fp = new HtmlFormatProvider();
fp.ExportSettings = new HtmlExportSettings
{
    StylesExportMode = StylesExportMode.Inline,
    DocumentExportLevel = DocumentExportLevel.Fragment,
    ExportStyleMetadata = false,
    ImageExportMode = ImageExportMode.UriSource
};
 
string html = fp.Export(editor.Document);
But in string html  I do not see <img> tag.

Please, help me as soon as possible.
Thanks!
Iva Toteva
Telerik team
 answered on 09 Apr 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?