Telerik Forums
UI for WPF Forum
10 answers
245 views
Hello,

I have a Problem with the Databinding to a RichTextBox that is located in a Datatemplate for a RadCarousel.

Here my Xaml:

<DataTemplate x:Key="customItemTemplate">
                    <Border Background="LightSlateGray" Padding="10">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />                                
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="600" />         
                            </Grid.RowDefinitions>                         
                            <telerik:RadRichTextBox Name="radRichTextBox"
                                    IsReadOnly="True"
                                    HorizontalAlignment="Stretch"
                                    VerticalAlignment="Stretch" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="5">
                                <telerik:RadDocument LayoutMode="Paged">
                                    <telerik:Section PageMargin="10, 10, 10, 10">                                     
                                        <telerik:Paragraph TextAlignment="Left">
                                            <telerik:Span Text="{Binding Redner}" />                                          
                                            <telerik:Span FontWeight="Bold" Text=" RadRichTextBox!" />
                                        </telerik:Paragraph>                                    
                                        <telerik:Paragraph>
                                            <telerik:Span FontWeight="Bold" Text="RadRichTextBox" />
                                            <telerik:Span Text=" is a control that is able to display and edit rich-text content including  formatted  text arranged in pages, paragraphs, spans (runs) etc." />
                                        </telerik:Paragraph>
                                        <telerik:Table LayoutMode="AutoFit">
                                            <telerik:TableRow>
                                                <telerik:TableCell>
                                                    <telerik:Paragraph>
                                                        <telerik:Span Text="Cell 1" />
                                                    </telerik:Paragraph>
                                                </telerik:TableCell>
                                                <telerik:TableCell>
                                                    <telerik:Paragraph>
                                                        <telerik:Span Text="Cell 2" />
                                                    </telerik:Paragraph>
                                                </telerik:TableCell>
                                            </telerik:TableRow>
                                            <telerik:TableRow>
                                                <telerik:TableCell ColumnSpan="2">
                                                    <telerik:Paragraph>
                                                        <telerik:Span Text="Cell 3" />
                                                    </telerik:Paragraph>
                                                </telerik:TableCell>
                                            </telerik:TableRow>
                                        </telerik:Table>
                                    </telerik:Section>
                                </telerik:RadDocument>
                            </telerik:RadRichTextBox>
                        </Grid>
                    </Border>
                </DataTemplate>
            </Grid.Resources>

The first Problem is the access to the line with <telerik:Span Text="{Binding Redner}" />
How can I make a Binding from Code-behind to the Controls in the Datatemplate?
The second Question is: How can i Bind the Width from the Carousel-Item to the Variable Monitor-Resolution? I need a Width with max 90% from the Carousel.

Sorry for my bad English. I hope you now what i mean.

Thank You



Johann
Top achievements
Rank 1
 answered on 15 Nov 2011
1 answer
133 views
Hi,

i have a GridView with Hierarchy.

1.How can i hide the expand Button.
2.How can i expand with the SelectChanged-Event. And i need the information from the Selected Row.

In your Forum i found a older Solution, but it wont work with the actual Telerik-Build.

Thank you

Nick
Telerik team
 answered on 15 Nov 2011
0 answers
295 views

Hello Telerik team,

When a user enters a value in the editable textbox of the RadCombobox that doesn't matches any of the available list of items then though the selected value is set to null , the text remains in the editable textbox even on lost focus of the RadCombobox.

I have a requirement where I have to perform a validation when the user tabs out of the editable RadCombobox or tries to click on a different control. The validation is to verify if the text entered by the user is available in the list of items and if not then alert the user of this and open the dropdown.

I implemented this validation on PreviewLostKeyboardFocus event as given below. But the problem is this event gets fired even when the focus enters the RadCombobox.

After the Ok button of the alert is clicked and then when I try to click of the dropdown's button, this event gets fired again and so the alert.

Why does this event fires when the focus enters the radcombobox.

Could you please guide me.

private void radCmbCustomer_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            if ((sender as RadComboBox) != null
                && ((sender as RadComboBox).ItemsSource as Customer[]) != null)
            {
                Customer[] larrCustomer = ((sender as RadComboBox).ItemsSource as Customer[]);
  
                /*Check if the code entered by the user*/
                TextBox txtEditableTextBoxRadCmbCustomer = radCmbCustomer.Template.FindName("PART_EditableTextBox", radCmbCustomer) as TextBox;
  
                if (txtEditableTextBoxRadCmbCustomer != null)
                {
                    string lstrCustomer = txtEditableTextBoxRadCmbCustomer.Text;
  
                    if (lstrCustomer != null && !lstrCustomer.Trim().Equals(string.Empty))
                    {
                        var lvarCustomerRecordsMatched = from lobjCustomer in larrCustomer
                                                        where lobjCustomer.CustomerName.ToUpper() == lstrCustomer.ToUpper()
                                                        select lobjCustomer;
  
                        if (lvarCustomerRecordsMatched != null && lvarCustomerRecordsMatched.ToList<Customer>().Count <= 0)
                        {
                            MessageBox.Show("The text you entered isn't an item in the list. \nSelect an item from the list, or enter text that matches one of the listed items.", "Alert");
  
                            radCmbCustomer.IsDropDownOpen = true;
                            txtEditableTextBoxRadCmbCustomer.Focus();
                            e.Handled = true;
                            return; 
             }
                    }
                }
            }


Thanks,
Regards,
Mausami


Mausami
Top achievements
Rank 1
 asked on 15 Nov 2011
0 answers
167 views
Hi,

I am using special slots to differentiate working hours and non working hours in scheduleview. For non working hours I change the background color just to indicate that the slot is not available. My problem is if two slots with the same time-span are added in special slot list then I get the slot background color very darker. For example, I add the slots which are in the past time to special slot collection. If the current time is 11 AM then the slot (12 am - 10:59am) is added in special slots. So It is reflected in Scheduleview and background color is changed. Now I have one more slot for setting the day break. The slot (10am-10:30am) is the break time. So I also need to add this in the special slot collection. If I add this the bg color of the break slot is very darker when compared to others. Because already one slot ( from 12 am -10:59) is a special slot. I dont want this to happen. HOw to do this?

With Thanks and Regards
Jeyakumar
jeya
Top achievements
Rank 1
 asked on 15 Nov 2011
1 answer
137 views
Hello,

I have a treelistview.  When user right click on an item and applies filter then I add one FilterDescriptor to the treelistview.
But it tries to filter on all the rows. My requirement is when user right click on any item then the filter should be applied only to the expanded nodes, not to those are collapsed nodes.

I have treelistview having upto 7 levels of expanded nodes. What i want is when user applies filter descriptor then it should filter all the data whose first level is expanded

Level 1 Level 2 Level 3 Level 4 Level 5 Level 6 Level 7
(-) Org
Dept 1
Cell 1
Mgr 1
Lead 1
Resp 1
Work1
Work2
Work3
Resp 2
Work4
Work5
Work6
(+) Dept 2
(+) Dept 3
(-) Dept4
Cell 4
Mgr 4
Lead 4
Resp 4
Work1
Work2
Work3
Resp 4
Work4
Work5
Work6
Dept 2 & Dept 3 are not in expanded state. While I filter I want the filter should be applied to those records of Dept 1 & Dept 4 only
User can right click on Level 7 data
.
Manishkumar
Top achievements
Rank 1
 answered on 15 Nov 2011
2 answers
317 views
There are times when I would need to cancel the Current Item Changed event. This is based on un-saved data for exmaple. So, when the user clicks on the right/left arrows (for navigation), the Data Form instantly changes the Current Item and then fires the event.

Well, if conditions determine that the user should not move forward/backward, how do I go back to the previous Current Item?

Example: Data Form has three values (1, 2, 3). Current Item is 2. User clicks right nav. arrow and Data Form takes the user to Item 3. based on a condition (true/false) I need the Data Form to stay on item 2 (or go back to item 2)

Any ideas would be appreciated.

Thanks, M
Marcelo
Top achievements
Rank 1
 answered on 14 Nov 2011
2 answers
113 views
Hello,

In a ScheduleView, I need to hide some days of each week (for example wednesdays and fridays). I look at the grouping and filtering functionalities, but I'm not sure it can help me with my need.

Is it possible to do this on a ScheduleView (only in WeekView) ? If yes, can you tell me how ?

Thank you in advance

Pauline
Pauline
Top achievements
Rank 1
 answered on 14 Nov 2011
8 answers
429 views
I would like to hide some rows in a GridView, however setting the Row's visibility to Collapsed still leaves a blank space where the row should be.

The trigger I am using to hide both GridViewGroupRows and GridViewRows looks like this:

<Style TargetType="{x:Type telerik:GridViewGroupRow}">
    <Setter Property="Visibility" Value="Visible" />
    <Style.Triggers>
        <DataTrigger Binding="{Binding Group.Key, RelativeSource={RelativeSource Self}}" Value="SomeValue">
            <Setter Property="Visibility" Value="Collapsed" />
        </DataTrigger>
    </Style.Triggers>
</Style>


I do not want to filter results because I need them for aggregate results in the groups and the footer. So how can I hide specific GridViewRows without filtering the data?
LHR
Top achievements
Rank 1
 answered on 14 Nov 2011
1 answer
209 views
Hi i have correct make a Context menù and binded it some example, 
after i have bind DelegateCommand some MyCommand,
And the Context menù is ok, but i whant pass to ContextMenù from the treeview Datacontext ,
the data, for call the right item when i click on the RadMenuItem, and take for example treeitemDatacontext.GuidId

In the telerik example use CommandParameter="{Binding Menu.ClickedListBoxItem, RelativeSource={RelativeSource Self}}"
but i dont undestand the Menu.ClickedListBoxItem item .

i have try, but not work, please help me 

regard 
<UserControl x:Class="Sicant.Modules.PSCDocument.Controls.TreeView"
                         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                         xmlns:example="clr-namespace:Sicant.Modules.PSCDocument"
                         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                         xmlns:tlkn="http://schemas.telerik.com/2008/xaml/presentation"
                         xmlns:Commands="clr-namespace:Sicant.Global.Commands;assembly=Sicant.Global" d:DesignHeight="600"
                         d:DesignWidth="300"
                         mc:Ignorable="d">
    <UserControl.Resources>
        <Style x:Key="SquareButton" TargetType="{x:Type Button}">
            <Setter Property="Button.Height" Value="25" />
            <Setter Property="Button.Width" Value="25" />
            <Setter Property="Margin" Value="2,2,2,2" />
        </Style>
        <Style x:Key="Menu" TargetType="Grid">
            <Setter Property="Height" Value="25" />
            <Setter Property="Width" Value="300" />
            <Setter Property="Background" Value="{StaticResource DarkBrush}" />
        </Style>
        <!--  nuovo per menù contestuale  -->
        <DataTemplate x:Key="Risorsa1_Template">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/Document.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="Risorsa2_Template">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/Mail_Closed.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </DataTemplate>
        <HierarchicalDataTemplate x:Key="Account_HierTemplate" ItemsSource="{Binding Children}">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/male.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="Container_HierTemplate" ItemsSource="{Binding Children}">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/Metal_Crate.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="PSC_HierTemplate" ItemsSource="{Binding Children}">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/PSC.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="Allegati_HierTemplate" ItemsSource="{Binding Children}">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/Download.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="Add_HierTemplate" ItemsSource="{Binding Children}">
            <StackPanel Orientation="Horizontal">
                <Image Height="30" Source="/Sicant.Global;component/Images/add-tab.png" />
                <TextBlock Margin="5 0 0 0" Text="{Binding Name}" />
            </StackPanel>
        </HierarchicalDataTemplate>
        <example:MyTemplateSelector x:Key="myTemplateSelector"
                                                                Template1="{StaticResource Risorsa1_Template}"
                                                                Template2="{StaticResource Risorsa2_Template}"
                                                                AccountTemplate="{StaticResource Account_HierTemplate}"
                                                                ContainerTemplate="{StaticResource Container_HierTemplate}"
                                                                PSCTemplate="{StaticResource PSC_HierTemplate}"
                                                                AllegatiTemplate="{StaticResource Allegati_HierTemplate}"
                                                                AddTemplate="{StaticResource Add_HierTemplate}"
                                                                />
        <DataTemplate x:Key="contextMenuItemTemplate">
            <tlkn:RadMenuItem Grid.Column="2"
                                        HorizontalAlignment="Left"
                                        VerticalAlignment="Center"
                                        Command="{Binding MyCommand}"
                                        CommandParameter="{
                                        Binding #What is the correct binding?#,
                                        RelativeSource={RelativeSource Self}
                                        }"
                                        Header="{Binding Header}"></tlkn:RadMenuItem>
 
        </DataTemplate>
        <Style x:Key="contextMenuItemStyle" TargetType="tlkn:RadMenuItem">
            <Setter Property="Width" Value="200" />
            <Setter Property="Height" Value="30" />
            <Setter Property="Icon" Value="{Binding Icon}" />
            <Setter Property="IsSeparator" Value="{Binding IsSeparator}" />
 
        </Style>
        <Style x:Key="treeViewStyle" TargetType="tlkn:RadTreeViewItem">
            <Setter Property="IsExpanded" Value="True" />
        </Style>
    </UserControl.Resources>
 
    <Grid>
        <DockPanel Name="dockTreePanel1" LastChildFill="True">
            <ContentControl Name="TopTreePanel"
                                            Height="AUTO"
                                            DockPanel.Dock="Top" />
            <ContentControl Name="MainTreePanel" DockPanel.Dock="Top" />
            <!--  contenitore di treeview complete  -->
            <StackPanel x:Name="Contenitore"
                                    Width="300"
                                    Margin="0"
                                    HorizontalAlignment="Left"
                                    VerticalAlignment="Top"
                                    Orientation="Vertical">
                <!--  contenitore di treeview Archivi completa  -->
                <StackPanel x:Name="Contenitore_Archivi"
                                        Width="300"
                                        Margin="0"
                                        HorizontalAlignment="Left"
                                        VerticalAlignment="Top"
                                        Orientation="Vertical">
                    <!--  contenitore di Titolo Archivi  -->
                    <Grid HorizontalAlignment="Left" Style="{StaticResource Menu}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="28" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="48" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Image Grid.Column="0"
                                     Width="16"
                                     Height="16"
                                     Margin="0"
                                     VerticalAlignment="Center"
                                     Source="{StaticResource ArchiveImg}" />
                        <TextBlock Grid.Column="1"
                                             Margin="15,0,0,0"
                                             HorizontalAlignment="Left"
                                             VerticalAlignment="Center"
                                             Text="Documento PSC" />
                        <Button Grid.Column="2"
                                        Width="20"
                                        Height="20"
                                        HorizontalAlignment="Right"
                                        VerticalAlignment="Center"
                                        Style="{StaticResource SquareButton}"
                                        ToolTip="Copia nell'archivio utente"
                                        Command="{x:Static Commands:PSCCommand.CmdPSC_PrintAll}">
                            <Image Width="14"
                                         Height="14"
                                         Source="{StaticResource PrintImg}" />
                        </Button>
                    </Grid>
                    <tlkn:RadTreeView x:Name="radTreeView"
                                                        ItemContainerStyle="{StaticResource treeViewStyle}"
                                                        ItemTemplateSelector="{StaticResource myTemplateSelector}">
                        <tlkn:RadContextMenu.ContextMenu>
                            <tlkn:RadContextMenu x:Name="radContextMenu"
                                                                     ItemContainerStyle="{StaticResource contextMenuItemStyle}"
                                                                     ItemTemplate="{StaticResource contextMenuItemTemplate}"
                                                                     Opened="RadContextMenu_Opened" />
                        </tlkn:RadContextMenu.ContextMenu>
                    </tlkn:RadTreeView>
                </StackPanel>
            </StackPanel>
        </DockPanel>
    </Grid>
</UserControl>

Yana
Telerik team
 answered on 14 Nov 2011
0 answers
95 views
Hi,

here is the XAML of my radGridView
<telerikGridView:RadGridView Name="grdScope"  ScrollMode="RealTime"   DockPanel.Dock="Bottom" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" CanUserInsertRows="False"  AutoGenerateColumns="False" CanUserSortColumns="False" CanUserFreezeColumns="False" CanUserReorderColumns="False" IsFilteringAllowed="False" CanUserResizeColumns="True" Telerik:StyleManager.Theme="Office_Blue" RowStyle="{StaticResource GridViewRowStyleRow}" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectionMode="Single" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding}" RowDetailsVisibilityMode="Collapsed" RowIndicatorVisibility="Collapsed" IsReadOnly="True" ShowGroupPanel="False"  AutoExpandGroups="True" RowLoaded="grdScope_RowLoaded" SelectionUnit="FullRow" SelectionChanged="grdScope_SelectionChanged"
 MouseDoubleClick="grdScope_MouseDoubleClick" DataLoadMode="Asynchronous" EnableColumnVirtualization="True" EnableRowVirtualization="False">


I am trying to set selected row programatically like this-

var item = ((IList<Task>) this.grdScope.ItemsSource)[this.SelectedTaskIndex];
this.grdScope.SelectedItem = item;

even when variable item has a non-null value, radGridView's SelectedItem property never changes from null to anything else when this code runs.
Am I doing something wrong?
Arpit
Top achievements
Rank 1
 asked on 14 Nov 2011
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
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?