Telerik Forums
UI for WPF Forum
4 answers
188 views
I'm trying to provide a "formula editor" for an in-house application.  I'm trying out the Expression Editor to see if it will work for what we want ... notably, the list of fields available for to be used in a formula will be determined at run-time depending on the application state/context.

I haven't done very much with WPF, so just to get my feet wet, I followed the instructions in the "Getting Started" help topic to create a small app that uses the Expression Editor (with a grid view).

I then created an almost identical sample app that uses the Expression Editor without a Grid View. 
Since the field list will be "dynamic" I'm using an ExpandoObject as the view model, as described in this forum post.  And in fact the ExpandoObject properties do show up in the field list. 
However, the expression always seems to be invalid ... even for simple expressions like "Qty_1 * Unit_Price_1". 
Again, this is almost all identical to the previous iteration ... except that now I don't have a data grid, and I'm generating the "property bag" dynamically. Do I have to use the editor in conjunction with a RadGridView?  Or is it the dynamic properties that are the problem?


Here's my model:
<PRE>
public
class FormInfoModel
{
    public IDictionary<stringobject> Elements
    {
         get { return _elements; }
    }
    private IDictionary<stringobject> _elements;
    public FormInfoModel()
    {
         _elements = new Dictionary<stringobject>();
         _elements.Add("Order_Date"DateTime.Today);
         _elements.Add("Qty_1", 0);
         _elements.Add("Unit_Price_1", 0);
    }
}
</PRE>
...and the view model:
<PRE>public class FormInfoViewModel
{
    public
ExpandoObject Info
   
{
        get { return _info;
}
    }
    private ExpandoObject _info;
    public void SetInfo(FormInfoModel model)
    {
       
dynamic dobj = new ExpandoObject();
        foreach (var key in model.Elements.Keys)
       
{
            (dobj as
IDictionary<string, object>).Add(key, model.Elements[key]);
       
}
        _info =
dobj;
    }
}</PRE>

Then in the MainWindow constructor I set the binding programmatically:

  _viewModel = this.Resources["FormInfoViewModel"] as FormInfoViewModel;
   ExpressionEditor.Item =
_viewModel.Info;

 

Vlad
Telerik team
 answered on 30 Oct 2012
1 answer
88 views
We have these two error in VS output window, and we cannot find any "OffPostion" within our entire solution, then we looked into the RadControl source code we purchased, and found there is "OffPostion" property in Telerik.Windows.Controls.Gauge.IndicatorData.  Could you please look into it?

System.Windows.Data Error: 40 : BindingExpression path error: 'OffPostion' property not found on 'object' ''BarIndicator' (Name='TrackBar')'. BindingExpression:Path=OffPostion; DataItem='BarIndicator' (Name='TrackBar'); target element is 'IndicatorData' (HashCode=46355463); target property is 'OffPostion' (type 'Double')

System.Windows.Data Error: 40 : BindingExpression path error: 'OffPostion' property not found on 'object' ''Marker' (Name='CurrentFrameMarker')'. BindingExpression:Path=OffPostion; DataItem='Marker' (Name='CurrentFrameMarker'); target element is 'IndicatorData' (HashCode=15234483); target property is 'OffPostion' (type 'Double')

Thanks.



Andrey
Telerik team
 answered on 30 Oct 2012
6 answers
526 views
I'm using the RadGridView inside a RadPane and trying to drag a row to another grid in a different pane. If the pane is pinned it works perfectly but when the pane is not pinned I get the following error as soon as I start dragging:

System.InvalidOperationException was unhandled by user code
  Message=The specified Visual and this Visual do not share a common ancestor, so there is no valid transformation between the two Visuals.
  Source=PresentationCore
  StackTrace:
       at System.Windows.Media.Visual.TransformToVisual(Visual visual)
       at Telerik.Windows.Controls.DragDrop.DragDropProvider.OnDragInitialized(Object sender, DragInitializeEventArgs e) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\DragDrop\DragProviders\DragDropProvider.cs:line 60
       at Telerik.Windows.DragDrop.DragInitializeEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\DragDropManager\DragInitializeEventArgs.cs:line 95
       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 Telerik.Windows.DragDrop.DragInitializer.StartDrag() in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\DragDropManager\DragInitializer.cs:line 173
       at Telerik.Windows.DragDrop.DragInitializer.DragSourcePreviewMouseMove(Object sender, MouseEventArgs e) in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\DragDropManager\DragInitializer.cs:line 157
       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.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)
  InnerException:

I'm stumped as to how go about fixing this so any help would be appreciated!

-Gary
Jc
Top achievements
Rank 1
 answered on 30 Oct 2012
5 answers
98 views
Hi Support Team,

I am using the following Way to do. Steps are following:

1. I create a new Column Group and Added a label and stack panel with 4 buttons and place all of them in Grid like following  in the code and finally assigned that grid into Header Template of RadGridView property.

<DataTemplate

xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""

xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""

xmlns:Tele=""http://schemas.telerik.com/2008/xaml/presentation""

xmlns:Event=""clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity""

xmlns:cmd=""clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"" >

<Grid HorizontalAlignment=""Stretch"" VerticalAlignment=""Stretch"" Background=""#EAF3FC"" Name=""grdcolumnHeader2"" >

<Grid.RowDefinitions>

<RowDefinition Height=""23""></RowDefinition>

</Grid.RowDefinitions>

<Grid.ColumnDefinitions>

<ColumnDefinition Width=""*""></ColumnDefinition>

<ColumnDefinition Width=""Auto""></ColumnDefinition>

</Grid.ColumnDefinitions>

<Label Name=""lblMonthName"

 

 

+ groupIndex.ToString() + @""" Grid.Row=""0"" Grid.Column=""0"" HorizontalAlignment=""Stretch"" HorizontalContentAlignment=""Center"" Padding=""0"" Margin=""0,2,0,0"" FontWeight=""DemiBold""

Content="""

 

 

+ monthContent + @"""></Label>

</Grid>

</DataTemplate>";

2. After creating new column Group, adding it into RadGridView like following and assigned it name like "month1"
RadGridView1.ColumnGroups.add(newColumnGroup);
3. the created dynamic columns based on no of days in a months and assigned column group name "month1"

newcolumn.ColumnGroupName="month1";

RadGridView1.Columns.Add(newcolumn);

This functionality works fine in version 2011 Q3 and 2012 Q2 releases.

But my issues is when I use 2012 Q2 version of telerik controls the Label controls and Panel with 4 buttons in the Colum Group Header does not cover all the columns and leave black color space at right side columns. screen shot has been attached with this thread. Please have a look and provide solution.

Note: If you do not understand anything please let me know. I will explain further.
Please help me to resove this issue. I am running out of solution.

Thanks
Laxman




 

 


 

Laxman
Top achievements
Rank 1
 answered on 30 Oct 2012
3 answers
184 views
Hi Support Team,

I would like to change the background color of GroupPanel items, by default it shows black color. I would like to change it to different color as per customer requirement. An Image has been attached for your better understanding.

Thanks
Laxman

Laxman
Top achievements
Rank 1
 answered on 30 Oct 2012
2 answers
195 views
Hi Support Team,

I want to remove borders from Grid View Header Row. I am using the following style to set the Background, Foreground and BorderThickness that style is following:

Style x:Key="GridHeaderRowStyle" TargetType="Tele:GridViewHeaderRow">
                        <Setter Property="Background" Value="#EAF3FC"/>
                        <Setter Property="Foreground" Value="#EAF3FC"/>
                        <Setter Property="BorderBrush" Value="#EAF3FC"/>
                        <Setter Property="BorderThickness" Value="0,0,0,0"/>
                        <Setter Property="Padding" Value="0,0,0,0"/>
                        <Setter Property="Margin" Value="0,0,0,0"/>
                       
                    </Style>
It changes the BackGround color but did not removing Borders. Image has been attached for your reference. You can have a look.
Please provide me the style how to do that. I don't know Expression Blend how to create styles.

Hope someone will help me to solve this issue.

Thanks
Laxman


Laxman
Top achievements
Rank 1
 answered on 30 Oct 2012
4 answers
557 views
Hello,


We are using 2012 Q3
I am AutoGenerating columns from a datatable to populate a RadGridView.

In the table there are columns who's DataType is a tuple with a couple strings, defined as "characteristic columns".

I tried setting the cell template using the following code,

        private void OneStopGrid_DataLoaded(object sender, EventArgs e)
        {
            foreach (GridViewColumn column in OneStopGrid.Columns)
            {
                if (ViewModel.CharacteristicColumns.Any(c => c.Name == column.Header))
                {
                    column.CellTemplate = (DataTemplate)this.FindResource("HistoryTemplate");
                }
            }
        }

The history template is a stackpanel containing a textblock which basically binds to one of the strings using Text="{Binding Item1}", and a rectangle which is standing in for a button.

The cell template is correctly set, but the datacontext is wrong, when I set the binding to Text="{Binding}" it showed that in the cells the datacontext was the DataRow.

I looked on the forums and found

http://www.telerik.com/community/forums/wpf/gridview/programmatically-creating-templated-columns.aspx

which advised me to to go to

http://blogs.telerik.com/vladimirenchev/posts/10-05-13/how-to-custom-percentage-column-with-radgridview-radprogressbar-and-radslider-for-silverlight-and-wpf.aspx

I set up a custom column as recommended and overrode the CreateCellElement using the following code


Then I used the ColumnsGenerating event to set up the columns as my custom column

        private void OneStopGrid_AutoGeneratingColumn(object sender, GridViewAutoGeneratingColumnEventArgs e)
        {
            if (ViewModel.CharacteristicColumns.Any(c => c.Name == e.Column.Header))
            {
                var templateColumn = new GridViewCharacteristicColumn();
                templateColumn.Header = e.Column.Header;

                e.Column = templateColumn;
            }
        }

Unfortunately I am still having the same problem. The Context is still the DataRow.

Anything I can do to get the binding to work correctly?


Thank you.
Eli
Top achievements
Rank 1
 answered on 29 Oct 2012
1 answer
191 views
I try to do this by using this Thread's Posts but when I Paste Some text contain hyperlink in my RadRichTextBox , It shows the hyperlinks as usual way and doesn't remove Its styles and etc.
I Want remove any styles, Images, Tables, Bullets, etc of document's content like when paste Clipboard in TextBox.
Petya
Telerik team
 answered on 29 Oct 2012
1 answer
131 views
Hi,

I seem to get a NullReferenceException from time to time when I assisigning the ScrollBarValueChanged event. It doesn't always throw the exception, and I can't quite work out how this is happening.
this.radRichTextBox.VerticalScrollBar.ValueChanged += radRichTextBox_ScrollBarValueChanged;


I assigned it in my RadRichTextbox loaded event:
private void radRichTextBox_Loaded(object sender, RoutedEventArgs e)
{
            //Set ListBoxItems
            AutoCompleteSetListBoxItems(1);
            //Set Autocomplete ListBox itemssource
            radListBox.ItemsSource = autoCompleteListItems;
 
            //Assign DocumentArranged event. This will in turn enable document changed event.
            this.radRichTextBox.DocumentArranged += radRichTextBox_DocumentArranged;
 
            //Assign CommandExecuting Event. This will catch cut, copy, paste etc
            this.radRichTextBox.CommandExecuting += radRichTextBox_CommandExecuting;
 
            //Assign Scroll Event To Reposition Popup AutoComplete Window
            this.radRichTextBox.VerticalScrollBar.ValueChanged += radRichTextBox_ScrollBarValueChanged;
}



Here's the stack trace:

   at TAS2.RadRichTextBoxAutoComplete.radRichTextBox_Loaded(Object sender, RoutedEventArgs e) in C:\TAS2 - Q3 2012\TAS2\RadRichTextBoxAutoComplete.xaml.cs:line 195
   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 e)
   at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
   at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
   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)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(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)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at TAS2.App.Main() in C:\TAS2 - Q3 2012\TAS2\obj\x86\Debug\App.g.cs:line 0



System.Reflection.RuntimeMethodInfo:
{Void radRichTextBox_Loaded(System.Object, System.Windows.RoutedEventArgs)}


Has anyone come across this error before?

Thanks for your time,

Rob

Petya
Telerik team
 answered on 29 Oct 2012
2 answers
213 views
Hello,

I'm looking for a way to disable the default Ctrl+V behavior, which simply creates a blank appointment (bypassing all validation).  I tried defining my own command bindings to override the default behavior as exemplified in the sample project included in this post  http://www.telerik.com/community/forums/silverlight/scheduleview/copy-paste-appointment.aspx;  however, I cannot find the appropriate namespace for CommandManager.SetCommandBindings().  System.Windows.Input.CommandManager does not contain a definition for SetCommandBindings, and I cannot find CommandManager under Telerik.Windows.Controls.   Likewise, when specifying <telerik:CommandManager.InputBindings> in XAML, I get 'The attachable property InputBindings was not found in type CommandManager'.  Am I missing something or is this only meant to work in Silverlight? 

I'm using the latest Q3 release.

Thanks in advance..
Vic
Vic
Top achievements
Rank 1
Iron
 answered on 29 Oct 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?