Telerik Forums
UI for WPF Forum
2 answers
101 views

Hi,

I need to create a set of RadMaskedNumericInput dynamically in code. I have the following (working) code with WPF TextBox

            var textBox = new TextBox
            {
                Height = 23,
                Width = 40,
                Margin = new Thickness(recalculatedPoint.X, recalculatedPoint.Y, 0, 0),
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Left
            };

            Binding bind = new Binding(bindingExpression)
            {
                Source = this,
                Mode = BindingMode.TwoWay,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
            };
            textBox.SetBinding(TextBox.TextProperty, bind);

 

When I change the control type from TextBox to RadMaskedNumericInput and binding property from TextBox.TextProperty to RadMaskedNumericInput.ValueProperty control is created but binding does not work.The code is:

            var textBox = new RadMaskedNumericInput
            {
                Height = 23,
                Width = 40,
                Margin = new Thickness(recalculatedPoint.X, recalculatedPoint.Y, 0, 0),
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Left
            };

            Binding bind = new Binding(bindingExpression)
            {
                Source = this,
                Mode = BindingMode.TwoWay,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
            };
            textBox.SetBinding(RadMaskedNumericInput.ValueProperty, bind);

 

Has anyone an idea why binding does not work?

Thanks in advance.

Have a nice day

 

Martin Ivanov
Telerik team
 answered on 26 Aug 2016
3 answers
833 views

Is there a way to make the validation error message for input controls in general (WatermarkedTextBox, NumericUpDown, MaskedInputs etc) appear on focus of the field? By default it appears on hovering over the small triangle in the upper-right corner of the control, when it's in the error state. This however is pretty hard for users to figure out and also sometimes to correctly "hit" with the mouse cursor.

Thanks!

Masha
Telerik team
 answered on 26 Aug 2016
1 answer
230 views

I'm trying to get the label to align left, and the text box to align left, in their respective columns. Can't make it happen. Both the label and the textbox seem to move to the same column, and have a mind of their own.

Here's the set-up:

 <Grid ShowGridLines="True" x:Name="DetailsTemplateEdit_Section_Main_Controls" HorizontalAlignment="Stretch" Background="White" MaxWidth="{Binding ActualWidth, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Border}}}">

                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="auto"/>
                            <RowDefinition Height="auto"/>
                        </Grid.RowDefinitions>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition MinWidth="150" MaxWidth="150"/>
                            <ColumnDefinition Width="2*"/>
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <telerik:DataFormDataField Grid.Row="0" Grid.Column="0" 
                                           Label="{x:Static properties:Resources.Compliance_Label_Name}" 
                                           DataMemberBinding="{Binding Name, Mode=TwoWay}" Template="{DynamicResource CustomDataFormDataFieldControlTemplate}">
                              <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True, ValidatesOnExceptions=True}" 
                              IsEnabled="{Binding CanBeDeleted}" x:Name="txt_name" HorizontalAlignment="Left"    
                                  Style="{StaticResource WaterMarkTextBox}" THOR:WaterMarkTextHelper.WatermarkText="{x:Static properties:Resources.Compliance_Label_Name}"
                                  MaxLength="50" ToolTip="{x:Static properties:Resources.ComplianceSetup_tooltip_name}" />
                        </telerik:DataFormDataField>

 

So, based on an example I saw the grid should have three columns, and I tried to set the label to be in column 1, and the text box in column 2, and I need both to align to the left within their columns.

Hints ?

Barry
Top achievements
Rank 1
 answered on 25 Aug 2016
11 answers
271 views
hi all, i've a graph editor using other graph component (graph#), now i'm evaluating to replace it with telerik diagram...

the actual component layout the graph with some predefined alghoritm and there's no way to store the changes the user made on the layout. the user can move a node but i cant get the new position when i save the diagram and store the changes...

So the most important requirment is to get and set for each node the location (x,y).

i need to link two nodes with two types of arrow, can telerik set a color for arrow depending on view model?

can i add a context menu to each node?

can i style the node using datatemplate?

add a pic to see the actual

thanks!



John
Top achievements
Rank 1
Iron
Iron
 answered on 25 Aug 2016
1 answer
153 views

Hi Everyone,

I have a unique required. I want show error when two rows are same. In attached image table all rows are valid rows except last and first rows. I want show error at first and last row. Can please help me here.

Note: There is no unique Column values.

 Regards,

Rajendar. 

Yoan
Telerik team
 answered on 25 Aug 2016
1 answer
71 views

Hi,

I'm binding a custom ObservableCollection to the AppointmentsSource of radScheduleView. This doesn't specialize ObservableCollection but still implements INotifyPropertyChanged, INotifyCollectionChanged and ICollection.

The fact is : DisplayedElements are not refreshed when I add an element (either with UI or code) and I need to refresh the ScheduleView (for example : changing ViewDefinition) for them to appear. A bigger problem is in inlining editing since CreateInlineAppointment does Remove immediately after CreateNew (because the new element isn't in the displayed element).

Then I wonder what is the "ObservableCollection" expected behaviour for the DisplayedElements to be refreshed ?
Same question may apply to "Appointment" (ours is implementing IAppointment, INotifyPropertyChanged).

Thanks for your help.

Yana
Telerik team
 answered on 25 Aug 2016
2 answers
481 views

I am trying to set the Foreground color of selected RadTreeViewItem but it cannot be set, though, other elements like Background is working.

<UserControl>
<UserControl.Resources>
<DataTemplate x:Key="AdvancedVariableTemplate">
            <RadioButton Checked="itemCont
<ResourceDictionary>
 
<!-- ItemContainerStyleSelector -->
<Style x:Key="AdvancedVariableItemContainerStyle" TargetType="telerik:RadTreeViewItem" BasedOn="{StaticResource RadTreeViewItemStyle}">
        <Setter Property="Background" Value="Red"/>
        <Setter Property="Foreground" Value="Green"/>
</Style>
</ResourceDictionary>
class AdvVariableContainerStyleSelector : StyleSelector
    {
        private Style darkThemeStyle;
        private Style lightThemeStyle;
 
        public override Style SelectStyle(object item, DependencyObject container)
        {
            Configuration config = UserConfigurations.getConfig();
            if (config.AppSettings.Settings["CurrentTheme"] != null)
            {
                switch (config.AppSettings.Settings["CurrentTheme"].Value.ToString().ToUpper())
                {
                    case "LIGHT":
                        return lightThemeStyle;
                    case "STANDARD":
                        return lightThemeStyle;
                    case "DARK":
                        return darkThemeStyle;
                    default:
                        return null;
                }
            }
            else
                return null;
        }
 
        public Style DarkThemeStyle
        {
            get
            {
                return this.darkThemeStyle;
            }
            set
            {
                this.darkThemeStyle = value;
            }
        }
 
        public Style LightThemeStyle
        {
            get
            {
                return this.lightThemeStyle;
            }
            set
            {
                this.lightThemeStyle = value;
            }
        }
    }
ainerRadio_Checked"
Content="{Binding CustomName}" ToolTip="{Binding TooltipString}"/>
        </DataTemplate>
        <HierarchicalDataTemplate x:Key="AdvancedGroupSeriesRadioTemplate" ItemsSource="{Binding LstAppDataSeries}">
            <TextBlock Text="{Binding CustomName}" FontWeight="Bold" />
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="AdvancedGroupSideTemplate" ItemsSource="{Binding  LstAppDataSeriesSides}">
            <TextBlock Text="{Binding CustomName}" FontWeight="Bold"/>
        </HierarchicalDataTemplate>
        <VariablesGroup:VariablesHierarchicalTemplate x:Key="AdvancedVariableItemTemplate"
            VariablesGroupsTemplate="{StaticResource  AdvancedGroupSideTemplate}"
            VariableSideTemplate="{StaticResource AdvancedGroupSeriesRadioTemplate}"
            VariableTemplate="{StaticResource AdvancedVariableTemplate}"/>
        <VariablesGroup:AdvVariableContainerStyleSelector x:Key="AdvancedVariableStyleSelector"
            DarkThemeStyle="{StaticResource AdvancedVariableItemContainerStyle}"
            LightThemeStyle="{StaticResource AdvancedVariableItemContainerStyle}"/>
    </UserControl.Resources>
<Grid>
<telerik:RadTreeView x:Name="lstVariablesAdvanced" SelectedItem="{DynamicResource AdvancedVariableItemContainerStyle}" VerticalAlignment="Stretch" Grid.Row="1" Grid.ColumnSpan="2" BorderThickness="0,0,0,0" ScrollViewer.CanContentScroll="False"
IsEditable="True" SelectionMode="Extended" ItemsSource="{Binding LstAppDataSeriesGrouping}" IsDropPreviewLineEnabled="False" IsDragPreviewEnabled="True"
IsDragTooltipEnabled="False" MouseDown="lstVariablesAdvanced_MouseDown"
IsSingleExpandPath="True" IsExpandOnSingleClickEnabled="False"  IsDragDropEnabled="False"
PreviewKeyDown="lstVariables_PreviewKeyDown" IsLineEnabled="True"
ItemTemplateSelector="{StaticResource AdvancedVariableItemTemplate}"
ItemContainerStyleSelector="{StaticResource AdvancedVariableStyleSelector}"             
Margin="10,0,6,0">
</telerik:RadTreeView>
</Grid>
</UserControl>

Dinko | Tech Support Engineer
Telerik team
 answered on 25 Aug 2016
2 answers
144 views

Hello,

When I have NewRowPosition set to Bottom, I see the "Click here to add new item" button at the bottom of the GridView, as expected.

My issue is that when I click the NewRow button, the button disappears as I am adding the new row. Note that this only happens when adding a new row - when editing an existing row, the NewRow button appears as expected.

Is there a way to always have the NewRow button shown when adding new rows?

 

Thanks,

-Thanos

Thanos
Top achievements
Rank 1
 answered on 24 Aug 2016
3 answers
237 views
Hi,

we are using Telerik RadDataForm in Our product which is using MVVM Pattern. we want to use our custom Commads  and Button for Commit and Cancel and to get this we are referencing RadDataFormStyle to set the command as shown.

<StackPanel x:Name="PART_FooterPanel" HorizontalAlignment="Right" Orientation="Horizontal">
      <telerik:RadButton x:Name="PART_CommitButton" Content="{TemplateBinding CommitButtonContent}" Command="{Binding Source={StaticResource DataContextProxy}, Path=Data.UpdateItem}"  InnerCornerRadius="0" Margin="2,4,4,4" MinWidth="48" MinHeight="20">
                                      <telerik:StyleManager.Theme>
                                          <telerik:Office_BlackTheme/>
                                      </telerik:StyleManager.Theme>
                                  </telerik:RadButton>
                                  <telerik:RadButton x:Name="PART_CancelButton" Content="{TemplateBinding CancelButtonContent}" Command="{Binding Source={StaticResource DataContextProxy},Path=Data.CancelItemUpdate}" InnerCornerRadius="0" Margin="2,4,4,4" MinWidth="48" MinHeight="20">
                                      <telerik:StyleManager.Theme>
                                          <telerik:Office_BlackTheme/>
                                      </telerik:StyleManager.Theme>
                                  </telerik:RadButton>
                              </StackPanel>

And following is the Rad Form Defined on the View. the 
CommandButtonsVisibility="None" is set to None because we don't want to see the navigation and other controls being used.

<telerik:RadDataForm x:Name="DataForm1" CurrentItem="{Binding CurrentLevelItem,UpdateSourceTrigger=PropertyChanged}"    Style="{StaticResource RadDataFormStyle1}"  DataFieldStyle="{StaticResource DataFormDataFieldStyle1}" AutoEdit="True" CommandButtonsVisibility="None"  />

The fields are auto generated and the problem is we want to get hold of the ValidationSummay in the View Model (if the condition of a text field etc is not met the Auto-generated validation Summary is Bound to a property in the view Model etc)to show it according to our requirements(i.e. on one of our self created Control to show information or errors etc) .
Is there a way to get hold of the validationSummay in the view Model?.

Thanks,
Jawad.
Ivan Ivanov
Telerik team
 answered on 24 Aug 2016
1 answer
951 views

Hello,

I am trying to create a email message viewer like Outlook using the RichTextbox.

Is this the right control to use for this scenario?

The viewer should be able to display plain-text emails and HTML emails.

 

I implemented it partially but I cant get the scrollbar visiblewhen the message is longer then what can be contained in the richtextbox.

<ContentControl Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="3">
    <Grid>
        <telerikHtml:HtmlDataProvider Html="{Binding BodyText, Mode=TwoWay}"
                                        RichTextBox="{Binding ElementName=rtbHtmlEmail}" x:Name="htmlDataProvider" />
        <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
            <telerik:RadRichTextBox x:Name="rtbHtmlEmail" Padding="15"
                                    MinWidth="800" MinHeight="650"
                                    HorizontalAlignment="Stretch"
                                    VerticalAlignment="Stretch"
                                    HorizontalContentAlignment="Left"
                                    VerticalContentAlignment="Top"
                                    IsReadOnly="True"
                                    LayoutMode="Flow"/>
        </ScrollViewer>
    </Grid>
</ContentControl>
    

Tanya
Telerik team
 answered on 24 Aug 2016
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
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?