Telerik Forums
UI for WPF Forum
5 answers
238 views
Hi,
We are using PivotGrid with localdatasourceProvider connected to an Entity Framework DbContext.
We are using a navigation property to group the datas.
Pivotgrid display the name of our object returned by  .toString().
We would like to display one property of this object for our datatemplate.

What is the best solution ?

Thanks for all, Tristan
tristan Brenner
Top achievements
Rank 1
 answered on 20 Sep 2013
6 answers
1.3K+ views
I am using a RadPropertyGrid. I am trying to use the AutoGeneratingPropertyDefinition event to provide a custom EditorTemplate with a textbox. I want to add a handler to the TextChanged event of the textbox but my event handler is never being called.

Relevant code:
public void GeneratingProperty(AutoGeneratingPropertyDefinitionEventArgs e)
{
    try
    {
        AvailableProperties property = (AvailableProperties)Enum.Parse(typeof(AvailableProperties), e.PropertyDefinition.Binding.Path.Path);
        if (IsAvailable(item.GetAvailableProperties(), property))
        {
            switch (property)
            {
                case AvailableProperties.Title:
                    FrameworkElementFactory textBoxFactory = new FrameworkElementFactory(typeof(TextBox));
                    textBoxFactory.AddHandler(TextBox.TextChangedEvent, new TextChangedEventHandler(TitleTextChanged));
                    textBoxFactory.SetValue(TextBox.BackgroundProperty, System.Windows.Media.Brushes.Tomato);
                    textBoxFactory.SetValue(TextBox.BorderBrushProperty, System.Windows.Media.Brushes.Transparent);
                    textBoxFactory.SetBinding(TextBox.TextProperty, new Binding("Title"));
 
                    DataTemplate template = new DataTemplate();
                    template.VisualTree = textBoxFactory;
                    template.Seal();
 
                    e.PropertyDefinition.EditorTemplate = template;
                    e.PropertyDefinition.OrderIndex = 0;
                    e.PropertyDefinition.DisplayName = "Title";
                    e.PropertyDefinition.Description = "The title of the attribute. Can only contain letters, numbers, and underscores.";
 
                    break;
                default:
                    // other properties go in case statements above here
                    break;
            }
        }
        else
        {
            e.Cancel = true;
        }
    }
    catch
    {
        e.Cancel = true;
    }
}
 
public void TitleTextChanged(object sender, TextChangedEventArgs e)
{
    if (sender is TextBox)
    {
        TextBox titleTextBox = (TextBox)sender;
        int caretIndex = titleTextBox.CaretIndex;
        string newValue = titleTextBox.Text;
 
        item.Title = newValue;
        ApplyCorrectedValue(newValue, item.Title, titleTextBox, caretIndex);
 
        NotifyOfPropertyChange(() => MappingsPanel);
    }
    else
    {
        Logger.Log("TitleChanged: source must be a TextBox");
        throw new ArgumentException("source must be a TextBox");
    }
}
I am using the 2012.2.912.35 version of the telerik dlls
Dimitrina
Telerik team
 answered on 20 Sep 2013
1 answer
44 views
Hiya, I'm sorry but without setting a precedent, I know that you are very busy, I would need a response as soon as possible:
http://www.telerik.com/community/forums/wpf/general-discussions/calling-a-udf-for-populating-a-radgridview-fails.aspx


I really very appreciate your help
Dimitrina
Telerik team
 answered on 20 Sep 2013
1 answer
108 views

Hi ya, I'm trying to populate one RadGridView using an UDF Sql Server which waits a parameter but it doesn't work:


XAML:

<telerik:RadGridView x:Name="dgvHistoricoOR"  HorizontalAlignment="Left" FontFamily="Segoe UI"
                                       FontSize="12" FontStyle="Normal"
          Margin="10,44,-185,0"  VerticalAlignment="Top" Height="175" Width="437"
          ColumnWidth="SizeToCells" Grid.ColumnSpan="2" Grid.RowSpan="2">
 
          <telerik:RadGridView.Columns>
              <telerik:GridViewDataColumn DataMemberBinding="{Binding ord_repalpha}" Header="{Resx RadGridViewOr_Or}"
                                          Width="40"/>
                      <telerik:GridViewDataColumn DataMemberBinding="{Binding F_Alta}" Header="{Resx RadGridViewOr_Alta}"
                                                  Width="60"/>
                      <telerik:GridViewDataColumn DataMemberBinding="{Binding F_Cierre}" Header="{Resx RadGridViewOr_Cierre}"
                                                  Width="60"/>
          </telerik:RadGridView.Columns>

Code-behind:


ada = New SqlDataAdapter("SELECT * FROM OR_Historico_Por_Cliente(@par1)", aBD.connection)
        ada.SelectCommand.Parameters.AddWithValue("@par1", Documento)
 
 
        ada.Fill(ds, "OR_Historico_Por_Cliente")
        Me.dgvHistoricoOR.ItemsSource = "OR_Historico_Por_Cliente"
 
        Me.dgvHistoricoOR.DataContext = ds




OR_Historico_Por_Cliente('') UDF Sql2k8 returns a TABLE

I don't get data, my Grid remains empty

I wonder, when I call Fill method, should I include the value for the parameter???


Help!
Dimitrina
Telerik team
 answered on 20 Sep 2013
1 answer
242 views
I'm working on a screen with WPF which has 3 listbox (list1, list2, list3), and i can drag items from list1 to list2 and list2 to list3 or even list1 to list3, and i can do it reversely.

I had to change the listbox (list3) to radListBox, because i wanted to implement the reorder within this list, i managed that drag and drop worked, and it did. but when a i wanted to drag an item from list3 (radlistbox), i got null in this variable :
" var data = ((DataObject)args.Data).GetData("DragData") as UcFileColumn", which UcFileColumn is a user control that i wanna cast with to drop in other lists. So insted od using "data" i thought using then selectedItem property to take the item dragged, and it works. Still one mysterious behaviour occured, is that when i dropped items in the lists3 (radListBox) and then drag them back into the lists(list1 or list2), and i wanted to dropped them back, the list prevent me to drop, i think when i remove item from teh radlistbox, the allowdrag dosent set anymore !!!!, is that because i used SelectedItem, if yes how should i get the element dragged from (DataObject)args.Data).GetData..

here is my XAML CODE : 

<UserControl.Resources>
        <Style x:Key="DraggableListBoxItem" TargetType="controls4:RadListBoxItem">
            <Setter Property="dragDrop:DragDropManager.AllowCapturedDrag" Value="True" />
            <Setter Property="dragDrop:DragDropManager.AllowDrag" Value="True" />
        </Style>
    </UserControl.Resources>
<ListBox Grid.Row="2" x:Name="List1"  ItemsSource="{Binding Source1, Mode=TwoWay}" AllowDrop="True" IsSynchronizedWithCurrentItem="True"
                     Style="{StaticResource ListBoxStyleMenu}" Margin="2,2,2,2"
                     VerticalAlignment="Stretch" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch">
 
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <UniformGrid Columns="2" />
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="Focusable" Value="False"/>
                            <Setter Property="Margin" Value="0,5,0,5" />
                        </Style>
                    </ListBox.ItemContainerStyle>
                </ListBox>
<ListBox Grid.Row="2" x:Name="List2"  ItemsSource="{Binding Source2, Mode=TwoWay}" AllowDrop="True" IsSynchronizedWithCurrentItem="True"
                     Style="{StaticResource ListBoxStyleMenu}" Margin="2,2,2,2"
                     VerticalAlignment="Stretch" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch">
 
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <UniformGrid Columns="2" />
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="{x:Type ListBoxItem}">
                            <Setter Property="Focusable" Value="False"/>
                            <Setter Property="Margin" Value="0,5,0,5" />
                        </Style>
                    </ListBox.ItemContainerStyle>
                </ListBox>
<controls4:RadListBox x:Name="List3"  ItemsSource="{Binding Source3}" AllowDrop="False" SelectedItem="{Binding SourceSelected, Mode=TwoWay}"
                     VerticalAlignment="Stretch" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch"
                    Margin="2,2,2,2" ItemContainerStyle="{StaticResource DraggableListBoxItem}">
                <controls4:RadListBox.DragDropBehavior>
                    <behaviors:ListBoxDragDropBehavior AllowReorder="True" dragDrop:DragDropManager.TouchDragTrigger="TapAndHold" />
                </controls4:RadListBox.DragDropBehavior>
 </controls4:RadListBox>


I'm looking forward for your response

Rosen Vladimirov
Telerik team
 answered on 20 Sep 2013
2 answers
218 views
Hello!

I'm having an issue when applying a font style to a numbered list in RadRiсhTextBox.

Steps to reproduce:
1. Create some lines of text
2. Select all of newly created lines of text.
3. Apply numbered list to these lines of text.
4. Set a font different from the default one

The numbrer indicator of the last line won't apply a new font.
The screenshot is attached to this post.

This can be reproduced even in your latest demo.

Thanks in advance.
Mikhail
Top achievements
Rank 1
 answered on 20 Sep 2013
22 answers
458 views
I have a WPF UserControl that has a GridView on it, when I place that UserControl in a WinForm application and try grouping by dragging the column header into the Grouping area it errors out.  The error I get is:

System.ArgumentNullException was unhandled
  Message="Value cannot be null.\r\nParameter name: otherVisual"
  Source="PresentationCore"
  ParamName="otherVisual"
  StackTrace:
       at System.Windows.Media.Visual.FindCommonVisualAncestor(DependencyObject otherVisual)
       at System.Windows.Media.Visual.TransformToVisual(Visual visual)
       at Telerik.Windows.Controls.DragDropManager.GetPopupPosition()
       at Telerik.Windows.Controls.DragDropManager.CreateDragAdorner()
       at Telerik.Windows.Controls.DragDropManager.PrepareElementToDrag(UIElement elementToDrag)
       at Telerik.Windows.Controls.DragDropManager.UIElement_MouseMove(Object sender, MouseEventArgs e)
       at System.Windows.Input.MouseEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
       at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
       at System.Windows.Input.InputManager.ProcessStagingArea()
       at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
       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, Int32 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, Boolean isSingleParameter)
       at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
       at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at WinFormTestControl.Program.Main() in C:\rccdev\BankReconcilation\WinFormTestControl\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Any Ideas?

Thanks,
Nate

Lenka
Top achievements
Rank 1
 answered on 19 Sep 2013
3 answers
512 views
It appears as though the WPF RichTextBox doesn't play well with mixing LTR and RTL characters in the same string. 

Pasting the following string into the TextBox gives mixed results including displaying question marks, flipping brackets and changing the position of neutral characers. The issue seems to persist even when putting an LRM character in front of the bracket, as seen in this article: http://www.iamcal.com/understanding-bidirectional-text/.

[KEY]="مرحبا العالم"

Pasting the same text into (for example) Notepad++ displays the text just fine. Is this a known issue, and are there any plans to support this?

Thanks,
Tom
Vasil
Telerik team
 answered on 19 Sep 2013
3 answers
303 views
I have the the following requirements, that I'm unsure as to how to implement with the Rad Diagram control:

Our business objects all have geographical coordinates associated with them.  The objects should be displayed as items on a diagram with the diagram positioning being representative of their geographical coordinates (Note The coordinate system in use is Northing / Easting). These coordinates should be two-way (i.e. the user should be able to drag the object to a new position and this should reflected in our object model).

Thus far I'm having difficulty understanding the following:

1) How to apply a 2 way scaling between the RadDiagram node's Point position and the business objects geographical Coordinates.  The scaling should take into consideration the available space in the RadDiagram and the series of coordinates being plotted.
2) Have the business object's geographical coordinates display in the InformationAdorner i.e. whenever the object is being dragged the adorner should display the coordinates and not the X & Y of the Point.
3) How to flip the Y axis of the diagram (perhaps this is to be done in the scaling?)

I've looked thru' all the examples on the RadDiagram, but none seem appropriate for the above requirements.  Any tips would be appreciated?

Gary.

Pavel R. Pavlov
Telerik team
 answered on 19 Sep 2013
5 answers
335 views
I am able to get the Mockup using CandleStick chart.. Please look into the attached Screenshot.
Can somebody help me in solving the below 2 issues..
    1. I have to display the "HighValue" and "LowValue" at the top and bottom of every item as in the mockup.
    2. Using Annotation, I have drawn a line at the value of "13" and i have named the Label as "BASE VALUE".
       I want that label to be displayed outside the graph as in the mockup.

<
telerik:RadCartesianChart x:Name="xCartesianChart" Height="300"  Width="400" Palette="Windows8" >
            <telerik:RadCartesianChart.VerticalAxis>
                    <telerik:LinearAxis x:Name="verticalAxis"  HorizontalLocation="Left"/>
            </telerik:RadCartesianChart.VerticalAxis>
              
            <telerik:RadCartesianChart.HorizontalAxis >
                    <telerik:CategoricalAxis VerticalLocation="Top" LineThickness="1" LabelInterval="2" ShowLabels="True"/>
            </telerik:RadCartesianChart.HorizontalAxis>
              
            <telerik:CandlestickSeries x:Name="xCandleStick" 
                                       CategoryBinding="XValue" 
                                       LowBinding="YValue2" HighBinding="YValue"
                                       CloseBinding="YValue2" OpenBinding="YValue" 
                                       ShowLabels="True"/>   
              
            <telerik:RadCartesianChart.Annotations>
                <telerik:CartesianGridLineAnnotation Axis="{Binding ElementName=verticalAxis}" Label="BASE VALUE" Value="13" Stroke="Green">
                        <telerik:CartesianGridLineAnnotation.LabelDefinition>
                            <telerik:ChartAnnotationLabelDefinition Location="Left" VerticalAlignment="Top" VerticalOffset="0" HorizontalOffset="80"/>
                        </telerik:CartesianGridLineAnnotation.LabelDefinition>
                    </telerik:CartesianGridLineAnnotation>
            </telerik:RadCartesianChart.Annotations>
              
        </telerik:RadCartesianChart>

//Code-behind
public MainWindow()
        {
            InitializeComponent();
  
            PopulateCartesianChart();
        }
  
void PopulateCartesianChart()
        {
            Random rnd = new Random();
  
            List<ChartDataClass> chartDatas = new List<ChartDataClass>();
  
            for (int i = 0; i < 20; i++)
            {
                ChartDataClass cdc = new ChartDataClass();
                cdc.XValue = i;
                cdc.YValue = rnd.NextDouble() * 100;
                cdc.YValue2 = cdc.YValue - 50;
  
                chartDatas.Add(cdc);
            }
  
            xCartesianChart.Series[0].ItemsSource = chartDatas;
}

Thanks in Advance :)
Evgenia
Telerik team
 answered on 19 Sep 2013
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
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?