Telerik Forums
UI for WPF Forum
2 answers
172 views
Hi,
    I am using RadDocking control in my prism application. I have created RadGroupPane addapter. Its working fine for a group pane if Its docked state, But if I change the state and try to add new view in my group pane then it throws an exception that index for region does not exist or out of index. "Insertion index was out of range. Must be non-negative and less than or equal to size.\r\nParameter name: index". is that a know issue, Can any one suggest me the solution for the problem please. The Adapter code is as follows:

public class DockManagerAdapter : RegionAdapterBase<RadPaneGroup>
{
protected override void Adapt(IRegion region, RadPaneGroup regionTarget)
        {
            region.ActiveViews.CollectionChanged += (s, e) =>
            {
                switch (e.Action)
                {
                    case NotifyCollectionChangedAction.Add:
                        foreach (var item in e.NewItems.OfType<RadPane>())
                        {
                            regionTarget.Items.Add(item);
                        }
                        break;
                    case NotifyCollectionChangedAction.Remove:
                        foreach (var item in e.OldItems.OfType<RadPane>())
                        {
                            item.RemoveFromParent();
                        }
                        break;
                    case NotifyCollectionChangedAction.Replace:
                        var oldItems = e.OldItems.OfType<RadPane>();
                        var newItems = e.NewItems.OfType<RadPane>();
                        var newItemsEnumerator = newItems.GetEnumerator();
                        foreach (var oldItem in oldItems)
                        {
                            var parent = oldItem.Parent as ItemsControl;
                            if (parent != null && parent.Items.Contains(oldItem))
                            {
                                parent.Items[parent.Items.IndexOf(oldItem)] = newItemsEnumerator.Current;
                                if (!newItemsEnumerator.MoveNext())
                                {
                                    break;
                                }
                            }
                            else
                            {
                                oldItem.RemoveFromParent();
                                regionTarget.Items.Add(newItemsEnumerator.Current);
                            }
                        }
                        break;
                    case NotifyCollectionChangedAction.Reset:
                        regionTarget
                            .EnumeratePanes()
                            .ToList()
                            .ForEach(p => p.RemoveFromParent());
                        break;
                }
            };


            foreach (var view in region.Views.OfType<RadPane>())
            {
                regionTarget.Items.Add(view);
            }
        }
protected override IRegion CreateRegion()
        {
            return new SingleActiveRegion();
        }
}

Regards,


George
Telerik team
 answered on 18 Sep 2012
3 answers
229 views
Hi there,

I'm using your ObservableItemCollection<T> and I have two issues with it. (v. 2012.2.607.40)

First, there's no constructor that takes an IEnumerable<T> or List<T> like the System.Collections.ObjectModel version it eventually inherits from. Though not a requirement, this is very useful for initializing a collection before doing anything else to it.

Secondly (and most importantly) there doesn't appear to be support for adding null items. I get a NullReferenceException when calling:

collection.Add(null);

The code is probably connecting to the item's PropertyChanged event, but a simple check for null during add/remove would allow support for null items.

I've extended the class to support the constructors, but I don't know overloading OnCollectionChanged or some other method will solve my issue. If so, please let me know what this method should contain.

On a slightly different topic, are the Suspend/Resume Notification methods called automatically on AddRange, InsertRange, and RemoveRange? Or do they need to be explicitly called?

Thanks!
Rossen Hristov
Telerik team
 answered on 18 Sep 2012
0 answers
107 views
Hi,

how can I achieve this look(attachment)?
-2 rows per record
-multiple columns(no groups)
Thanks!
Dmitrijs
Top achievements
Rank 1
 asked on 18 Sep 2012
2 answers
252 views
HI,

I have a problem. I have AutoCompleteTextBox and TreeView, both work with the same SelectedItem.
The node must expand, when the user uses AutoCompleteTextBox, but it only works only if I expand node per MouseClick and Collapse it.

   <telerik:RadTreeView Grid.Row="1" Grid.ColumnSpan="3"
                                             IsEnabled="{Binding DisableOnEditMode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                             ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                             SelectedItem="{Binding SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                            <telerik:RadTreeViewItem IsExpanded="True"  Header="Nachschlagstabellenliste" Style="{StaticResource HeaderItem}" >
                                <telerik:RadTreeViewItem  Header="Dokumenttyp"
                                                     ItemTemplate="{StaticResource LookupItemTemplate}" Style="{StaticResource SubHeaderItem}"
                                                     ItemsSource="{Binding DocumentTypes, UpdateSourceTrigger=PropertyChanged}"/>
 
                                <telerik:RadTreeViewItem  Header="Dokumentart"
                                                     ItemTemplate="{StaticResource LookupItemTemplate}" Style="{StaticResource SubHeaderItem}"
                                                     ItemsSource="{Binding DocumentSysTypes, UpdateSourceTrigger=PropertyChanged}"/>
...

Thanks!
Dmitrijs
Top achievements
Rank 1
 answered on 18 Sep 2012
9 answers
1.5K+ views
I have just started using the Rad controls for WPF and have come across an issue I cannot resolve on my own. 

I open a RadWindow with the ShowDialog() function call.  The window appears, and is in Modal mode, however, if I set focus to another application, when I come back to my WPF application, the modal window is no longer on top.  There are no icons for the modal window in my task bar.  The only way I can get back modal window is to use the Alt-tab functionality.

In the XAML my Radwindow is defined:

                <telerik:RadWindow Name="radManagePartsWindow" Height="530" Width="1000"
                                   telerik:Theming.Theme="Office_Blue" Visibility="Collapsed"
                                   ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
                                   CanMove="True"
                                   Header="Part Manager"
                                   Opened="radManagePartsWindow_Opened"
                                   Closed="radManagePartsWindow_Closed" Activated="radManagePartsWindow_Activated"
                                   >
In my code I access it via:

        private void btnManagePart_Click(object sender, RoutedEventArgs e)
        {
            radManagePartsWindow.DataContext = DataContext;
            radManagePartsWindow.ShowDialog();
        }
How can I get the modal window to ALWAYS be on top?


Miroslav Nedyalkov
Telerik team
 answered on 18 Sep 2012
1 answer
134 views
I'm working on a project in which I am trying to make all the windows dockable. I have had success doing this but am having one small problem. I have the theme set at Expression_Dark for everything and when I undock one of the windows everything is fine, but when I dock it back anywhere on the screen the theme is broken on that specific pane and the color changes back to default. How can I fix this problem and reset the theme. I was going to invoke the panestatechange event and reset the theme from there but cant figure out the correct code to put within the event. My code for the xaml is posted below...any help would be appreciated. Thanks.
<ui:UserControlBase x:Class="CommandAlkon.COMMANDtrack.UserInterface.Controls.Dashboard"
    xmlns:ui="clr-namespace:CommandAlkon.COMMANDtrack.UserInterface.Bases"
    Background="Transparent"
    xmlns:parts="clr-namespace:CommandAlkon.COMMANDtrack.UserInterface.Controls.DashboardParts">
  
    <Grid>
        <telerik:RadDocking  BorderThickness="0" Padding="0" IsRestricted="True" RestrictedAreaMargin="100,100,100,100" telerik:StyleManager.Theme="Expression_Dark" >
  
            <telerik:RadSplitContainer Orientation="Vertical" InitialPosition="DockedLeft">
                <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark">
                    <telerik:RadPane Header="Regions" CanUserClose="False" CanDockInDocumentHost="True">
                        <telerik:RadPane.Content>
                            <Border x:Name="BorderMainRegion" Grid.Row="1" CornerRadius="0,0,10,10" BorderThickness="0,1,0,0" Margin="2" >
                            <ListBox x:Name="RegionsListBox" />
                            </Border>
                        </telerik:RadPane.Content>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
                <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark">
                    <telerik:RadPane Header="Plants" CanUserClose="False" >
                        <telerik:RadPane.Content>
                            <Border x:Name="BorderMainPlant" Grid.Row="1" CornerRadius="0,0,10,10"  BorderThickness="0,1,0,0" Margin="2" >
                            <ListBox x:Name="PlantsListBox" />
                            </Border>
                        </telerik:RadPane.Content>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
  
            <telerik:RadSplitContainer Orientation="Horizontal" InitialPosition="DockedTop" Height="300" telerik:StyleManager.Theme ="Expression_Dark">
                <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark">
                    <telerik:RadPane Name="PlantChartPane" Header="Plant" CanUserClose="False" >
                        <telerik:RadPane.Content>
                            <Border x:Name="BorderPlantChart" Grid.Row="1" CornerRadius="0,0,10,10" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,1,0,0" Padding="2,0,2,3"/>
                        </telerik:RadPane.Content>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
                <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark">
                    <telerik:RadPane Header="Schedule" CanUserClose="False">
                        <telerik:RadPane.Content>
                            <Border x:Name="BorderMainGrid" Grid.Row="1" CornerRadius="0,0,10,10" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,1,0,0">
                            <ui:SchedulingControl x:Name="ScheduleLateness" IsScheduleLatenessControl="True"  />
                            </Border>
                        </telerik:RadPane.Content>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
                <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark">
                    <telerik:RadPane Name="TrucksChartPane" Header="Trucks" CanUserClose="False" />
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
  
            <telerik:RadSplitContainer Orientation="Horizontal" InitialPosition="DockedBottom" Height="150" >
                <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark">
                    <telerik:RadPane Name="ExceptionsPane" Header="Exceptions" CanUserClose="False" >
                        <telerik:RadPane.Content>
                            <parts:Exceptions Grid.Column="0"/>
                        </telerik:RadPane.Content>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
                <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark" >
                    <telerik:RadPane Header="Suggestions" CanUserClose="False" >
                        <telerik:RadPane.Content>
                            <parts:Suggestions Grid.Column="0" />
                        </telerik:RadPane.Content>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
  
            <telerik:RadSplitContainer InitialPosition="DockedRight" Width="700">
                <telerik:RadPaneGroup telerik:StyleManager.Theme="Expression_Dark" >
                    <telerik:RadPane Header="Loads" CanUserClose="False">
                        <telerik:RadPane.Content>
                            <parts:Loads Grid.Column="0" />
                        </telerik:RadPane.Content>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
              
        </telerik:RadDocking>
    </Grid>
</ui:UserControlBase>
Georgi
Telerik team
 answered on 18 Sep 2012
0 answers
72 views
I have a DateTime collection in my viewmodel, I want to display a icon in the day header of SchedulieView(MonthViewDefinition) if it is present in DateTime collection.

Otherwise icon will not be displayed for that day if it is not present in DateTime collection.

What would be the best approach to achieve this?
Kshamesh
Top achievements
Rank 1
 asked on 18 Sep 2012
1 answer
270 views
I created a custom control that derives from RadDatePicker. I need to enlarge the control to make it easier to manipulate with a touchscreen and add a 'Today' button that jumps to today's date.

I've replaced the drop down icon with an image and added the button below the calendar drop-down with its Command bound to a DelegateCommand in the code-behind, as defined in CalendarStyle's Template setter. I had originally designed this as a user control, but both the command binding and the image's source is broken when converting to a custom control (and putting the templates in Themes\Generic.xaml).

<ResourceDictionary ...>
    <Style BasedOn="{StaticResource {x:Type telerik:RadDatePicker}}" TargetType="local:RadDatePickerXtnd">
        <Setter Property="CalendarStyle">
            ...
            <ControlTemplate TargetType="{x:Type telerik:RadCalendar}">
                <StackPanel>
                    <Grid>{Calendar control markup}</Grid>
                    <Button Name="PART_TodayButton" Command="{Binding TodayCommand}" Content="Today" />
                </StackPanel>
            </ControlTemplate>
            ...
        </Setter>
    </Style>
    <Setter Property="Template">
        ...
        <ContentControl x:Name="DropDownIcon" Background="White" Foreground="Black" IsTabStop="False">
            <ContentControl.Template>
                <ControlTemplate TargetType="{x:Type ContentControl}">
                    <Image Source="..\img\calendar.png" Width="24" Height="24" />
                </ControlTemplate>
            </ContentControl.Template>         
        </ContentControl>
        ...
    </Setter>
</ResourceDictionary>

The command binding no longer works because I don't know how to set a DataContext within Generic.xaml and I cannot find the right place in code behind to use Template.FindName() to traverse through RadDatePicker > RadCalendar > Button so I can set the binding programmatically. I get an InvalidOperationException - "This operation is valid only on elements that have this template applied." when I try to run "cal.Template.FindName("PART_TodayButton", this);" in OnApplyTemplate(). I'm guessing that CalendarStyle is applied afterwards.

public class RadDatePickerXtnd : RadDatePicker
{
    public Microsoft.Practices.Prism.Commands.DelegateCommand TodayCommand { get; private set; }

    ...
    public
override void OnApplyTemplate()
    {
        base.OnApplyTemplate();
  
        var cal = (RadCalendar)Template.FindName("PART_Calendar", this);
        var todayBtn = (Button)cal.Template.FindName("PART_TodayButton", this);
        // Bind Button.Command to DelegateCommand here
    }
    ...
}

In addition, the Image control isn't displaying the image in the drop-down button. I've tried moving the image to the base directory or the Themes directory and updating the path to no avail.
Michael
Top achievements
Rank 1
 answered on 18 Sep 2012
4 answers
402 views
Hello !

I'm using a custom hierarchy on a RadGridView as defined below :

<telerik:RadGridView x:Name="rgvAttributes" AutoGenerateColumns="False" CanUserDeleteRows="False"
                     IsReadOnlyBinding
="{Binding IsEditAttributesGrid,Mode=TwoWay}"
                    
ItemsSource="{Binding ListEntries}"
                    
SelectedItem="{Binding SelectedAttribute, Mode=TwoWay}" SelectionMode="Single">
    <i:Interaction.Behaviors>
        <helper:IsExpandableBehavior IsExpandableSourcePropertyName="IsExpandable" />
    </i:Interaction.Behaviors>
    <telerik:RadGridView.ChildTableDefinitions>
        <telerik:GridViewTableDefinition />
    </telerik:RadGridView.ChildTableDefinitions>
    <telerik:RadGridView.Columns>
        [...]
    </telerik:RadGridView.Columns>
    <telerik:RadGridView.HierarchyChildTemplate>
        <DataTemplate>
            <Control:ContentStepVisualizer />
        </DataTemplate>
    </telerik:RadGridView.HierarchyChildTemplate>
</telerik:RadGridView>

In order to hide the Expand/Collapse Hierarchy button on several rows, I'm using the following method :
  1. As the name explains, the simple behavior "IsExpandableBehavior" is used to bind the "IsExpandable" property of each GridViewRow to the corresponding object property of the ObservableCollection<Attribute> ListEntries in my ViewModel,
  2. Setting the "IsExpandable" property of one of the Attribute object to False correctly hide the Expand/Collapse Hierarchy button of the corresponding row in the RadGridView.

When calling ExpandAllHierarchyItems() on the RadGridView, every hidden Expand/Collapse Hierarchy buttons appears back and every row expands.

It seems that the ExpandAllHierarchyItems() of RadGridView methods doesn't consider the state of the "IsExpandable" property before expanding a GridViewRow.

Is this the desired behavior or I have done something wrong provoking it ?

Many thanks for your help !

TheFlo

Aaron
Top achievements
Rank 1
 answered on 17 Sep 2012
0 answers
81 views
Hi,

What's the easiest/most efficient way of showing sums (or other aggregates) in a different currency than the current culture. For example, if my current culture is fr-FR but I have a column that's in USD, how would I go about showing the values and the totals in USD?
SADHANA
Top achievements
Rank 1
 asked on 17 Sep 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
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
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
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?