Telerik Forums
UI for WPF Forum
2 answers
436 views
I can create RadContextMenu with a DropShadowEffect if I just show it in a Grid; however if I try and attach it to a Window.ContextMenu (or any other control) the shadow doesn't appear.  I've tried all sorts of variations using Resource Styles and ResourceDictionaries, and nothing works.  I'm including the MainWindow.xaml source and a screen shot showing the results.

<Window
    x:Class="WpfApplication2.MainWindow"
    x:Name="Window"
    Title="MainWindow"
    Width="640" Height="480"
    >
    <telerik:RadContextMenu.ContextMenu>
        <telerik:RadContextMenu ClickToOpen="True"
                                InheritDataContext="False">
            <telerik:RadContextMenu.Effect>
                <DropShadowEffect ShadowDepth="3" Opacity="0.445" RenderingBias="Quality"/>
            </telerik:RadContextMenu.Effect>
                <telerik:RadMenuItem Header="Copy" />
                <telerik:RadMenuItem Header="Paste" />
                <telerik:RadMenuItem Header="Cut" />
                <telerik:RadMenuItem IsSeparator="True" />
                <telerik:RadMenuItem Header="Select All" />
            </telerik:RadContextMenu>
    </telerik:RadContextMenu.ContextMenu>
 
    <Grid x:Name="LayoutRoot">
        <telerik:RadContextMenu
            Margin="105,53,247,147"
            ClickToOpen="True"
            InheritDataContext="False">
            <telerik:RadContextMenu.Effect>
                <DropShadowEffect ShadowDepth="3" Opacity="0.445" RenderingBias="Quality"/>
            </telerik:RadContextMenu.Effect>
            <telerik:RadMenuItem Header="Item 1">
                <telerik:RadMenuItem Header="Sub Item 1"/>
                <telerik:RadMenuItem Header="Sub Item 2"/>
            </telerik:RadMenuItem>
            <telerik:RadMenuItem Header="Item 2">
                <telerik:RadMenuItem Header="Sub Item 3"/>
                <telerik:RadMenuItem Header="Sub Item 4"/>
                <telerik:RadMenuItem Header="Sub Item 5"/>
            </telerik:RadMenuItem>
        </telerik:RadContextMenu>
    </Grid>
</Window>



What am I doing wrong?

Thanks in advance,
Steve



Steve
Top achievements
Rank 1
 answered on 18 Jun 2012
1 answer
128 views
Hello,

I'm experiencing an issue with using the mouse selection zooming (where you select a rectangle to zoom in on).  After a few successful zooms, an error is thrown (ArgumentException: Width and Height must be non-negative.) when trying to zoom in to fine detail.  I assume this has something to do with rendering the pan/zoom bar, but I'm not certain.

I can catch the previewMouseUp event, but I'm not sure how to correctly check/handle this issue.

Any help/guidance would be appreciated.

Also, the interesting bit of the stacktrace from the exception:

at System.Windows.Size..ctor(Double width, Double height)
   at Telerik.Windows.Controls.ChartView.ChartPanAndZoomBehavior.UpdatePanAndZoom(Double startX, Double endX, Double startY, Double endY) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Behaviors\ChartPanAndZoomBehavior.Branch.cs:line 278
   at Telerik.Windows.Controls.ChartView.ChartPanAndZoomBehavior.AdornerLayerMouseLeftButtonUp(Object sender, MouseButtonEventArgs e) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\Chart\Visualization\Behaviors\ChartPanAndZoomBehavior.Branch.cs:line 252
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
Paul
Top achievements
Rank 1
 answered on 18 Jun 2012
1 answer
161 views
I am writing this lines of code 

  <telerik:RadComboBox Height="28" Margin="0,112.051,12,0" Grid.Row="1" VerticalAlignment="Top">
      <telerik:RadComboBox.SelectionBoxTemplate>
       <DataTemplate>
        <TextBlock Text="{Binding}" Foreground="Red"/>   
    </DataTemplate>   
   </telerik:RadComboBox.SelectionBoxTemplate>
      <telerik:RadComboBoxItem Content="Item 1"/>
      <telerik:RadComboBoxItem Content="Item 2"/>
      <telerik:RadComboBoxItem Content="Item 3"/>
     </telerik:RadComboBox>
But this is not working. Please tell me what i am doing worng ?
Thank you.
Vladi
Telerik team
 answered on 18 Jun 2012
8 answers
151 views
Hi,

i'm using two RadGridViews with one MVVM (ObservableCollection<foptxt>()). With Drag and Drop i moove the items from GridA to GridB.

How do i add a DropHandler for the dropped items? I just found an example for a Listbox, but i can't change this to run with a GridView.

Thanks
Best Regards
Rene
Dimitrina
Telerik team
 answered on 18 Jun 2012
4 answers
111 views
Hi there,

We need to support some customised formats for user to type in the input box. e.g. if I type a "+5" in the input box today (03/03/2010), it needs to be converted to 08/03/2010  (the 5th day from today's date).

We've tried to bind a converter to the datepicker, but it's too late as the input has already been updated by the default parsing logic. And the fact that having inputText as a private member is not helping either.

So, Is there a way to change/extend the datepicker's default inputbox text parsing mechanism? Thanks in advance.




Cheers,






Doots
Top achievements
Rank 1
 answered on 18 Jun 2012
1 answer
56 views
Hello support
i have problem to run telerik sample , i have send screen shot and zip file of the sample
i want to send the "DragAndDrop" smple how i do this?
please advice 
best  regards shimon
Dimitrina
Telerik team
 answered on 18 Jun 2012
1 answer
226 views
Hello All,

RadComboBox has a property called "EmptyText" which displays when the combo box has not been set (meaning SelectedIndex = -1).  Is there similar functionality in the RadGridView that is *already baked in*?  When a user changes the filter and the grid has not rows to display, I want to display a message in the body of the grid like "No rows to display". 

- Rashad Rivera
Vlad
Telerik team
 answered on 18 Jun 2012
2 answers
147 views
Hi,

Please could you inform me why I cannot set an ItemContainerStyle for a RadBreadcrumbItem. I thought that I may be able to use a style to set a default image, with the following XAML...

<telerik:RadBreadcrumb.ItemContainerStyle>
                <Style TargetType="{x:Type telerik:RadBreadcrumbItem}">
                    <Setter Property="Image" Value="{StaticResource Folder16}"/>
                </Style>
            </telerik:RadBreadcrumb.ItemContainerStyle>

However, I get the following error at runtime....

{"'RadBreadcrumbItem' type must derive from FrameworkElement or FrameworkContentElement."}

Thanks
reg
Top achievements
Rank 1
 answered on 17 Jun 2012
2 answers
172 views
Hi,

After upgrading to RadControls for WPF 2012.2.607, the Demos app crashes on launch with the following error:

"WPF Demos has stopped working".

We are running Windows 7 64 bit.

Problem signature:
  Problem Event Name: CLR20r3
  Problem Signature 01: wpf demos.exe
  Problem Signature 02: 1.0.0.0
  Problem Signature 03: 4fd0cd4f
  Problem Signature 04: mscorlib
  Problem Signature 05: 4.0.0.0
  Problem Signature 06: 4ee9af8e
  Problem Signature 07: 3fda
  Problem Signature 08: 13c
  Problem Signature 09: System.UnauthorizedAccess
  OS Version: 6.1.7601.2.1.0.256.48
  Locale ID: 3081
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Legoless
Top achievements
Rank 1
 answered on 16 Jun 2012
0 answers
192 views
I have a form with a couple of RadGridView controls on it.  The form in question is a UserControl, embedded in a TabItem in a TabControl on the MainWindow.  There is another UserConrol on another TabItem in the same TabControl, which is used to display details of the selected item in one of the RadGridView controls, and other that is used to display the details of the selected item in the other RadGridView.

Here is the Xaml for one of the RadGridView controls:
<telerik:RadGridView AutoExpandGroups="True"
                     AutoGenerateColumns="False"
                     CanUserDeleteRows="False"
                     CanUserFreezeColumns="False"
                     CanUserInsertRows="False"
                     CanUserResizeColumns="True"
                     CanUserSortColumns="True"
                     EnableColumnVirtualization="True"
                     EnableRowVirtualization="True"
                     FontSize="16"
                     FontWeight="Bold"
                     IsReadOnly="True"
                     MouseDoubleClick="ReadsGrid_MouseDoubleClick"
                     Name="ReadsGrid"
                     RowStyleSelector="{StaticResource StyleSelector}"
                     SelectionChanged="ReadsGrid_SelectionChanged"
                     SelectionUnit="FullRow"
                     ScrollViewer.CanContentScroll="True"
                     ScrollViewer.HorizontalScrollBarVisibility="Auto"
                     ScrollViewer.VerticalScrollBarVisibility="Auto"
                     ShowGroupFooters="True"
                     ToolTip="Matching Reads">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding Plate,       Mode=OneWay}"
                                    Header="Plate"
                                    Width="*" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding State,       Mode=OneWay}"
                                    Header="State"
                                    Width="75" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding TimeStamp,  Mode=OneWay, Converter={StaticResource DateConverter}}"
                                    Header="Date & Time"
                                    Width="175" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding GPSInformation.Position.Latitude, Converter={StaticResource CoordConverter}, ConverterParameter=NS}"
                                    Header="Latitude"
                                    Width="142" />
        <telerik:GridViewDataColumn DataMemberBinding="{Binding GPSInformation.Position.Longitude, Converter={StaticResource CoordConverter}, ConverterParameter=EW}"
                                    Header="Longitude"
                                    Width="142" />
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

From the code-behind, here is the code for the SelectionChanged event handler and for the MouseDoubleClick event handler:
private void ReadsGrid_MouseDoubleClick( object sender, MouseButtonEventArgs e ) {
    if ( OkToSwitchToRecordDetails ) {
        TabItem searchTabItem = (TabItem) Parent;
        TabControl tabControl = (TabControl) searchTabItem.Parent;
        TabItem recordDetailsTabItem = FindTab( typeof( EditRecordDetails ) );
        recordDetailsTabItem.IsSelected = true;
    }
    e.Handled = true;
}
private void ReadsGrid_SelectionChanged( object sender, SelectionChangeEventArgs e ) {
    ReadViewModel read = (ReadViewModel) ReadsGrid.SelectedItem;
    ReadsGrid.ScrollIndexIntoView( ReadsGrid.Items.IndexOf( read ) );
    HavePrevRecord = ReadsGrid.Items.IndexOf( read ) > 0;
    HaveNextRecord = ReadsGrid.Items.IndexOf( read ) < ( Reads.Count - 1 );
    RecordDetailsControl.DisplayRead( read );
    e.Handled = true;
}

Everything works, but there's something very odd going on.  When you double click on the row, the RadGridView seems to scroll.  In fact, it scrolls far enough to bring the row you just double clicked on off the screen. Note that the call to ScrollIndexIntoView has no effect:  I added that to try to bring the row back into view and it's doing nothing.

In the UserControl in the other tab, there are two buttons named "PrevButton" and "NextButton".  Here is the code for their Click event handlers:
private void NextButton_Click( object sender, RoutedEventArgs e ) {
    try {
        SearchControl.NextRecord( LastRecord );
    } catch ( ObjectNotFoundException ex ) {
        string msg = MessageGenerator.ExceptionMessage( "Error getting next record: ", ex );
        Log.Error( msg );
        CarSystemMessageBox.Show( msg, "Error Getting Next Record" );
    }
    // Mark event handled
    e.Handled = true;
}
private void PrevButton_Click( object sender, RoutedEventArgs e ) {
    try {
        SearchControl.PrevRecord( LastRecord );
    } catch ( ObjectNotFoundException ex ) {
        string msg = MessageGenerator.ExceptionMessage( "Error getting next record: ", ex );
        Log.Error( msg );
        CarSystemMessageBox.Show( msg, "Error Getting Next Record" );
    }
    // Mark event handled
    e.Handled = true;
}

And here's the NextRecord and PrevRecord methods in the SearchControl:

public void NextRecord( ReadViewModel read ) {
    // Figure out the index of the last object in the ReadsGrid RadGridView's Items collection
    int lastObj = ReadsGrid.Items.Count - 1;
    // Get the index of this object in the ReadsGrid's Items collection.
    int idxRead = ReadsGrid.Items.IndexOf( read );
    // The next record is the next one in the ReadsGrid's Items collection, if there is one.
    if ( idxRead < lastObj ) {
        // Set HaveNextRecord and HavePrevRecord
        HavePrevRecord = true;
        HaveNextRecord = idxRead < lastObj;
        // Select the next record.
        read = ReadsGrid.Items[ idxRead + 1 ] as ReadViewModel;
    } else {
        // There isn't a next record.  Set HaveNextRecord and HavePrevRecord
        HaveNextRecord = false;
        HavePrevRecord = idxRead > 0;
    }
    // Select the Read & scroll it into view
    ReadsGrid.SelectedItem = read;
    ReadsGrid.ScrollIntoView( read );
}
public void PrevRecord( ReadViewModel read ) {
    // Declare some variables we will need to use
    int idxRead  = -1;
    // Get the index of this object in the ReportRows array.
    idxRead = ReadsGrid.Items.IndexOf( read );
    // The previous record is the previous one in the ReadsGrid's Items collection, if there is one.
    if ( idxRead > 0 ) {
        // Set HaveNextRecord and HavePrevRecord
        HaveNextRecord = true;
        HavePrevRecord = idxRead > 0;
        // Select the next record.
        read = ReadsGrid.Items[ idxRead - 1 ] as ReadViewModel;
    } else {
        // There isn't a previous record.  Set HavePrevRecord to false and HaveNextRecord
        HavePrevRecord = false;
        HaveNextRecord = idxRead < ( ReadsGrid.Items.Count - 1 );
    }
      
    // Select the Read & scroll it into view
    ReadsGrid.SelectedItem = read;
    ReadsGrid.ScrollIntoView( read );
}

Again, everything works, but the ScrollIntoView doesn't work.  I've always had that call there, in case you kept clicking one of the buttons and eventually selected a row that wasn't in view.

All rows are the same height, and turning RowVirtualization off has no effect.  The rows are still off the screen when I come back to the tab with the RadGridViews.

Is this a bug? Is there some property I have turned on that's breaking it?

Tony

P.S.  I am using version 2012.1.326.40
Tony
Top achievements
Rank 1
 asked on 15 Jun 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?