Telerik Forums
UI for WPF Forum
1 answer
188 views
I have some RadDocumentPanes. When I opening a document (RadDocumentPane) of some type, I want to load a different layout. How can this be done?

I tried switching layout in the ActivePaneChanged event, but this throws an InvalidOperationException. Please help!

private void dockingPaneManager_ActivePaneChanged(object sender,
    Telerik.Windows.Controls.Docking.ActivePangeChangedEventArgs e)

{

    if (e.NewPane == pane1)

        LoadLayout(Properties.Resources.Pane1);

    else if (e.NewPane == pane2)

         LoadLayout(Properties.Resources.Pane2);

    else if (e.NewPane == pane3)

         LoadLayout(Properties.Resources.Pane3);

}


<telerik:RadDocking x:Name="dockingPaneManager" ActivePaneChanged="dockingPaneManager_ActivePaneChanged">
<telerik:RadDocking.DocumentHost>
  <telerik:RadSplitContainer>
    <telerik:RadPaneGroup>
      <telerik:RadDocumentPane x:Name="pane1" Title="1st" telerik:RadDocking.SerializationTag="Pane1">
        <telerik:RadDocumentPane.Content>
          ... some content ...
        </telerik:RadDocumentPane.Content>
      </telerik:RadDocumentPane>
      <telerik:RadDocumentPane x:Name="pane2" Title="2nd" telerik:RadDocking.SerializationTag="Pane2">
        <telerik:RadDocumentPane.Content>
          ... some content ...
        </telerik:RadDocumentPane.Content>
      </telerik:RadDocumentPane>
      <telerik:RadDocumentPane x:Name="pane3" Title="3rd" telerik:RadDocking.SerializationTag="Pane3">
        <telerik:RadDocumentPane.Content>
          ... some content ...
        </telerik:RadDocumentPane.Content>
      </telerik:RadDocumentPane>
    </telerik:RadPaneGroup>
  </telerik:RadSplitContainer>
</telerik:RadDocking.DocumentHost>


This is the thrown exception:
---------------------------

---------------------------
System.InvalidOperationException: The specified Visual is not an ancestor of this Visual.

   at System.Windows.Media.Visual.TrySimpleTransformToAncestor(Visual ancestor, Boolean inverse, GeneralTransform& generalTransform, Matrix& simpleTransform)

   at System.Windows.Media.Visual.InternalTransformToAncestor(Visual ancestor, Boolean inverse)

   at Telerik.Windows.Controls.ApplicationHelper.TransformToScreenRoot(UIElement target) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\Common\ApplicationHelper.cs:line 285

   at Telerik.Windows.Controls.RadPane.GetDraggableArea(Boolean allowDragReorder) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadPane.cs:line 1378

   at Telerik.Windows.Controls.RadPane.OnHeaderMouseLeftButtonDown(Object sender, MouseButtonEventArgs e) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadPane.cs:line 886

   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)

   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)

   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)

   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)

   at System.Windows.Input.InputManager.ProcessStagingArea()

   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)

   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)

   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)

   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)

   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
---------------------------
OK  
---------------------------

Vladi
Telerik team
 answered on 10 Dec 2012
1 answer
209 views
According to the documentation, I can specify a collection to provide my own palette of colours for the colorpicker.  Can I do that using xaml?  And if so, how?

Thanks,
Petar Mladenov
Telerik team
 answered on 10 Dec 2012
1 answer
169 views
Hello,
I am working on a RadGridView that requires the capability to move rows up and down within the grid, ideally I would like Alt+Up/Down to execute a command that moves the selected row up or down in the grid. What I've done is created a behavior that is attached to the grid and wires up to the KeyDownEvent or PreviewKeyDownEvent. My issue is that when I hit Up or Down neither of the events are fired. I understand that those keys are used for navigation but I want to handle the event when Alt+Up/Down is pressed but I can't seem to get either of the events when focused on the grid no matter what modifier keys I have pressed. Is there any way to get the KeyDownEvent/PreviewKeyDownEvent to fire for the Up/Down buttons on a RadDataGrid?

AssociatedObject.AddHandler( UIElement.KeyDownEvent, mKeyEventHandler, true );

EDIT: Using the 'preview' event handler directly (rather that AddHandler) appears to work so I'm past my issue. Thanks

AssociatedObject.PreviewKeyDown += _HandlePreviewKeyDown;


Thanks,
Jason
Maya
Telerik team
 answered on 10 Dec 2012
1 answer
92 views
HOw can I go about checking if the clicked slot was for a new appointment or for an edit?

I want to be able to only edit slots. Not create any new ones.
Vladi
Telerik team
 answered on 10 Dec 2012
0 answers
148 views
Hi,

I'm try this code for drag selecting item if set AllowDrop true not drag and drop file in listbox.

<Window.Resources>
    <Style TargetType="telerik:RadListBoxItem">
        <Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True" />
    </Style>
</Window.Resources>
<Window.DataContext>
    <local:ExampleViewModel />
</Window.DataContext>
 
<Grid Background="White" x:Name="LayoutRoot">
    <telerik:RadListBox ItemsSource="{Binding CountryList}" AllowDrop="True" x:Name="listBox" Height="200"
                        HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <telerik:RadListBox.ItemTemplate>
            <DataTemplate>
                <Grid Height="50" Width="100" Background="LightBlue" telerik:DragDropManager.AllowDrag="False">
                    <TextBox Text="{Binding CountryName}"
                             VerticalAlignment="Center"
                             PreviewMouseLeftButtonDown="TextBox_PreviewMouseLeftButtonDown"
                             MouseLeave="TextBox_MouseLeave"
                             HorizontalAlignment="Center"/>
                </Grid>
            </DataTemplate>
        </telerik:RadListBox.ItemTemplate>
        <telerik:RadListBox.DragDropBehavior>
            <telerik:ListBoxDragDropBehavior AllowReorder="True"/>
        </telerik:RadListBox.DragDropBehavior>
        <telerik:RadListBox.DragVisualProvider>
            <telerik:ScreenshotDragVisualProvider />
        </telerik:RadListBox.DragVisualProvider>
        <telerik:RadListBox.DropVisualProvider>
            <telerik:LinearDropVisualProvider />
        </telerik:RadListBox.DropVisualProvider>
    </telerik:RadListBox>
John
Top achievements
Rank 1
 asked on 09 Dec 2012
1 answer
386 views
When my tree view expands to no longer fit the window, vertical scroll bars do not appear. When I set:
ScrollViewer.VerticalScrollBarVisibility="Visible"

I initially get a disabled scroll bar. When I expand my tree, the height of the scroll bar is taller than the window so I still can't scroll.
My tree is inside a RadDocumentPane. I have a RadGridView in another RadDocumentPane and scrolling works for it.
Is there something special for a RadTreeView?
David
Top achievements
Rank 1
 answered on 08 Dec 2012
0 answers
256 views
I need a tree view and I'm trying to figure out which on I should use: TreeView or TreeListView.  My needs are simple so I can't tell which one would be better. Do you have any recommendations?
David
Top achievements
Rank 1
 asked on 08 Dec 2012
2 answers
155 views
I have a grid where one of the columns is bound to a foreign key object. 

<telerik:RadGridView Margin="2,38,2,2" Name="notesListGridView" CanUserInsertRows="False" CanUserDeleteRows="False" IsReadOnly="True" AutoGenerateColumns="False" TabIndex="5" SelectionMode="Extended" >
     <telerik:RadGridView.Columns>
          <telerik:GridViewDataColumn UniqueName="Employee_Note_Date" Header="Date" Width="120"       DataMemberBinding="{Binding Employee_Note_Date, StringFormat=d}" CellStyle="{StaticResource CustomCellStyle}" />
          <telerik:GridViewDataColumn UniqueName="Employee_Note_Types" Header="Type" Width="200" DataMemberBinding="{Binding Employee_Note_Types, Path=Employee_Note_Types.Description}" CellStyle="{StaticResource CustomCellStyle}" />
          <telerik:GridViewDataColumn UniqueName="Notes" Header="Notes" Width="*" DataMemberBinding="{Binding Notes}" TextWrapping="Wrap" CellStyle="{StaticResource CustomCellStyle}"></telerik:GridViewDataColumn>
     </telerik:RadGridView.Columns>
</telerik:RadGridView>

When I use the built in grid filtering I am able to filter that column. However when I try to filter with code: 

string searchTxt = searchTextBox.Text;
notesListGridView.FilterDescriptors.Clear();
CompositeFilterDescriptor compositeDescriptor = new CompositeFilterDescriptor();
compositeDescriptor.LogicalOperator = FilterCompositionLogicalOperator.Or;
 
foreach (Telerik.Windows.Controls.GridViewColumn column in notesListGridView.Columns)
{
     if (column.IsVisible)
     {
          GridViewDataColumn col = (GridViewDataColumn)column;
          if (col.DataType.ToString() == "System.String")
          {
               compositeDescriptor.FilterDescriptors.Add(new FilterDescriptor(column.UniqueName, FilterOperator.Contains, searchTxt, false));
          }
     }
}
notesListGridView.FilterDescriptors.Add(compositeDescriptor);

When I add the CompositeFilter the notesListGridView.FilterDescriptors I get an InvalidCastException:
Invalid cast from 'System.String' to 'CoreDataServiceReference.Employee_Note_Type'.

How can I apply a filter to the foreign key object in the code?
Dev
Top achievements
Rank 1
 answered on 07 Dec 2012
3 answers
114 views
I have a grid with a DataColumn that has it's CellTemplate set to a DataTemplate that contains a ComboBox.  The ComboBox has it's ItemsSource bound to a Collection in a view model. The collection contains simple integers.

The ComboBox's ItemTemplate contains an Image, with its Source bound to the item, using a Converter that returns a pack URI appropriate to the integer. The result is that cell contains a dropdown of images.

And all of that is working fine.

My problem is that if I group on the column, or apply a filter on the column, the grouping control and the filtering control provide a list of the values of the cells in the column, and the values it displays are the integers, not the images.

Seems to me that if I could get the grouping and filtering controls to apply the converter I am already using in the cell, I'd have what I'd like. But I don't know if that is possible.

Is it?
Dimitrina
Telerik team
 answered on 07 Dec 2012
9 answers
783 views
I have recently implemented themes in my application.  The application has two themes, Day & Night.  The application changes themes by loading a ResourceDictionary that defines different colors for the same named SolidColorBrush DynamicResources.

Here is the xaml for the style I'm using for the rows in the all of the RadGridView controls in my application.  This is in the app,xaml file:
<Style TargetType="telerik:GridViewRow">
    <Setter Property="Background"
            Value="{DynamicResource TextBackground}" />
    <Setter Property="Foreground"
            Value="{DynamicResource TextForeground}" />
</Style>

I think the first row is probably the row used to insert new rows into the Grid.  Here's the XAML for one of my RadGridControls:

<telerik:RadGridView AutoExpandGroups="True"
                     AutoGenerateColumns="False"
                     Background="{DynamicResource DataBackground}"
                     CanUserDeleteRows="False"
                     CanUserFreezeColumns="False"
                     CanUserInsertRows="False"
                     CanUserResizeColumns="False"
                     CanUserSortColumns="True"
                     EnableColumnVirtualization="True"
                     EnableRowVirtualization="True"
                     FontSize="16"
                     FontWeight="Bold"
                     Foreground="{DynamicResource DataForeground}"
                     Grid.Column="1"
                     Grid.ColumnSpan="2"
                     Grid.Row="1"
                     IsReadOnly="True"
                     ItemsSource="{Binding Path=DataRetentionPolicies, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:AdvancedSettingEditor}}}"
                     Margin="5"
                     Name="DataPolicies"
                     SelectionUnit="FullRow"
                     ScrollMode="Deferred"
                     ScrollViewer.CanContentScroll="True"
                     ScrollViewer.HorizontalScrollBarVisibility="Auto"
                     ScrollViewer.VerticalScrollBarVisibility="Auto"
                     ShowGroupFooters="True"
                     TabIndex="8"
                     ToolTip="Data Maintenance Properties"
                     Visibility="{Binding Converter={StaticResource BoolToVisibility}, Mode=TwoWay, Path=EnableRetention, RelativeSource={RelativeSource AncestorType={x:Type cs:AdvancedSettingEditor}}}">
    <telerik:RadGridView.Columns>
        . . .
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

As you can see, the control is read-only and it doesn't allow inserting, editing or deleting of rows.

In the Day theme, the rows in my RadGridView have black text on white backgrounds. In the Day theme, they're supposed to have yellow text on black backgrounds. And every row in the DataGridControl matches this color scheme exept the first, which still has a white background.

How do I get the first row's background to change with the other rows?
Tony
Tony
Top achievements
Rank 1
 answered on 07 Dec 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
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?