Telerik Forums
UI for WPF Forum
0 answers
349 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
223 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
78 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
140 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
153 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
259 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
3 answers
171 views
Hello,

I have a problem with the ScheduleViewDragDropBehavior class.
I want to be able to drop anything in my RadScheduleView, in an empty slot OR in an appointment.

Here is my dragDropBehavior class :
public class CPlanningTelerikDragDropBehavior : Telerik.Windows.Controls.ScheduleViewDragDropBehavior
       {
           
           public override void Drop(DragDropState state)
           {/*Drop code*/
 
               base.Drop(state);
           }
       }

But i don't know how to determine if the destination is an appointment or an empty slot.

Is there any way to do that ?

Regards,
Philippe.
Yana
Telerik team
 answered on 09 Apr 2012
5 answers
353 views
Does the RadRichTextBox support a 'paste plain text' mode?

If a user wants to paste in text that is formatted as a table, I would like it to just paste the data in the tables, becuase our reporting technology cannot handle html tables.

Any ideas if this can be done? I don't see anything in the Demos about special paste functions
Ivailo Karamanolev
Telerik team
 answered on 09 Apr 2012
2 answers
221 views
Hello,

I have created a contentTemplate and an editTemplate for my control which inherits from RadDiagramShape. All works well with the other controls, but once I click on the RadRichTextbox in the editTemplate, the control switches back to the contentTemplate. So it is impossible to edit the text of the RadRichTextbox during runtime.

To make it more clear:
diagramItem -> editmode -> mouse click on the RadRichTextbox -> diagramitem immediately goes out of edit mode.

The RadRichTextbox has not been modified, and the control doesn't have any special events. All buttons, the watermarkTextbox and the normal Textbox work as they should.

Am I missing something or is the functionality not yet implemented in the RadDiagram component?

Regards,
James
James
Top achievements
Rank 1
 answered on 09 Apr 2012
5 answers
132 views
Hi,

Here is the my xaml code.
<
Window x:Class="WpfApp.MainWindow"
        Title="MainWindow" Height="200" Width="525"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
 
    <Grid x:Name="grid">
        <telerik:RadGridView Name="radGridView1" ItemsSource="{Binding DataList}" Grid.Row="1" />
    </Grid>
</Window>

I would like to know how to detect the scrollbar exist or not in gridview ?
Vlad
Telerik team
 answered on 09 Apr 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
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
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
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
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
Bronze
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?