Telerik Forums
UI for WPF Forum
3 answers
150 views
Hello,

I have entity framework classes, one is DownloadLink and i have these two columns to gird (not binded to any DownloadLink properties)

<telerik:GridViewColumn Header="New F.H.Id" UniqueName="NewFilehostId" Width="*"></telerik:GridViewColumn><telerik:GridViewColumn Header="New URL" UniqueName="NewUrl" Width="*"></telerik:GridViewColumn>

Only easy way to iterate row i found is using  radGridViewReuploadStatus.Items, but that way i can't access those two added columns.

So i think easiest way would be to somehow extend DownloadLink and add these two new fields, i tried it like this

class
 DownloadLinkExtended : DownloadLink {         public DownloadLinkExtended(DownloadLink origDl){             PropertyInfo[] myObjectProperties = origDl.GetType().GetProperties(); //BindingFlags.Public | BindingFlags.NonPublic             foreach (PropertyInfo pi in myObjectProperties)             {                 object value = pi.GetValue(origDl, null);                 if (value != null)                 {                     try                     {                         pi.SetValue(this, value, null);                     }                     catch (Exception) {                          //selze to na komplexnim typu jako napr. PostData                     }                 }             }         }         public string NewUrl { getset; }         public string NewIdOnFilehost { getset; }     }
But well that reflection does not work and i don't have it set up like DownloadLinkExtended.DownloadLink because then every grid bound column would need to be DownloadLink.field and i don't want it that way. Also setting it in constructor for each property individually is to much error prone manual work.

Other solution would be to get rows somehow like this
IList<GridViewRow> rows = radGridView.ChildrenOfType<GridViewRow>();
But since there is no .Rows this it seams to me that it is not your recommended way.

So what is ideal solution. Or how to nicely extend my DownloadLink class to include that two new required fields?
Ivan Ivanov
Telerik team
 answered on 20 Jun 2011
7 answers
100 views
Hi,

Looks like RadDragAndDropManager is not ThreadStatic which causes application crash as We have UI in two different threads.

I have RadDragAndDropManager.EnableNativeDrag = true set in my Base control Constructor. 

Now that base control is used at multiple places in my application. 
In our main UI thread we have this control and from this thread we started another thread which has UI and in that window we make use of our control at many places in various window forms. And so whenever we open a window which contain that base control lookslike RadDragAndManager call the reset function on  DesktopDragDropProvider object. 

But when I go back to first UI Thread and click on the control that is using RadDragAndDropManager UE occurs.

************** Exception Text **************
System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
   at System.Windows.Threading.Dispatcher.VerifyAccess()
   at System.Windows.Threading.DispatcherObject.VerifyAccess()
   at System.Windows.DependencyObject.GetValue(DependencyProperty dp)
   at System.Windows.Controls.ContentControl.get_Content()
   at Telerik.Windows.Controls.DragDrop.UndetectableWindow.set_Child(FrameworkElement value)
   at Telerik.Windows.Controls.DragDrop.DesktopDragDropProvider.Reset()
   at Telerik.Windows.Controls.DragDrop.DesktopDragDropProvider.OnLeftMouseButtonUp(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.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.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(DependencyObject sender, MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.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 Xm8.App.X.Program.ShowControlCenter(ControlCenterParameters ccParams)
   at Xm8.App.X.Program.ShowCC(Object parameter)
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart(Object obj)


In my understanding RadDragAndDropManager should be ThreadStatic rather than just the static. that might solve the problem.

Regards
Sanket
Yordanka
Telerik team
 answered on 20 Jun 2011
6 answers
308 views
My column footers are summed using an aggregate (SumFunction).
I need to calculate the percent of a grand total represented by the sum of each column. The grand total is calculated as a sum function too.

Essentially I'm looking to do the following: (think Excel)

B5/E5  C5/E5  D5/E5 etc...where E5 is the grand total in the totals column and B5, C5 etc are the sums for their respective columns.

I'm following the pattern for creating a custom aggregate. Here is what I have so far.  What I need is a way to pass the grand total value to the Percent method. Or if that isn't possible some other approach?

public static double Percent<TSource>(IEnumerable<TSource> source, Func<TSource, int?> selector)
{
  return (source.Select(selector).Aggregate(0, (t1, t2) => t1 + (int)t2) * .01);
}
Maya
Telerik team
 answered on 20 Jun 2011
3 answers
127 views
Hi 

Filter with out case sensitive work fine.
But the same items with Different Case come as Different CheckBoxes in the Filter Select Option

eg:
ABD  and abc comes as different filter select options. I want to set this as one.
Is this possible

Rossen Hristov
Telerik team
 answered on 20 Jun 2011
1 answer
376 views
Hi,
I want Show Only Year In DatePicker.

I Set DateSelectionMode="Year".

But When i select a year it show 1/1/year.

i want to only year not 1/1/year

thank`s for Help.
Yana
Telerik team
 answered on 20 Jun 2011
3 answers
184 views

A couple of questions:

1)  The *TRIAL* download page for WPF controls list the following options:

WPF 3.5 - Automatic Installation (msi, 199 MB)
WPF 3.5 - Manual Installation (zip, 193 MB)
WPF 3.5 - DLLs only (zip, 19 MB)
WPF 4 - Manual installation (msi, 92 MB)
WPF 4 - Manual installation (zip, 193 MB)
WPF 4 - DLLs only (zip, 19 MB)

As you can see, There is no "Automatic" installation for the WPF 4 controls? Is that just a typo? is the "WPF 4 - Manual installation (msi, 92 MB)" really supposed to be named "WPF 4 - Automatic installation (msi, 92 MB)"? The link for the payed version appears to label them correctly.

2) the download page also list hot fixes for both 3.5 and 4.0 versions. Do i still have to apply the hot fixes or are they included on the latest full download?

3) If I installed the 3.5 version by mistake and now want to install the 4.0 version. Will the WPF 4.0 installer ask me if I want to upgrade my 3.5 dlls to 4.0 or do I have to do all this manually. If I have to do it manually is there a link that show the steps to follow to make this as painless of a process as possible?

Thank you. 
Milan
Telerik team
 answered on 20 Jun 2011
1 answer
154 views
When setting the RadGridView.SortMemberPath = "SomeMemberName", when the model object raises an INotifyPropertyChanged for SomeMemberName, the grid doesn't seem to re-sort.

Is this the expected behavior?

I'm trying to display dynamically updated data in the grid, where I want to sort the column on some arbitrary member property in the model (e.g. display CPU history in a column and sort on the 10 second average).

How can I make sure that the grid automatically re-sorts when a member in the model is updated?

Thanks,
Alex
Vlad
Telerik team
 answered on 20 Jun 2011
4 answers
470 views
I have this scenario:
 
<
telerik:RadRibbonWindow
   ...
     
    WindowStartupLocation="CenterScreen"
    Title="Xxxxx"
    Height="700"
    Width="980"
    MinHeight="700"
    MinWidth="980"
    Name="XxxxxWindow"
    AutomationProperties.Name="XxxxxWindow"
     
    Closing="XxxxxWindow_Closing"
    >
     
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Closed">
            <c:CommandAction Command="{Binding Path=ShellClosedCommand}" SyncOwnerIsEnabled="True" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
     
    <DockPanel SizeChanged="mainRegion_SizeChanged" Name="mainRegionDockPanel" AutomationProperties.Name="mainRegionDockPanel" >       
        <telerik:RadRibbonBar
            DockPanel.Dock="Top"
            prism:RegionManager.RegionName="{x:Static common:RegionNames.RibbonBarRegion}"
            ApplicationName="{Binding Title}"
            HorizontalContentAlignment="Stretch"
            HelpButtonVisibility="Visible"
            HelpRequested="RadRibbonBar_HelpRequested"
            Name="RibbonTitle"
            AutomationProperties.Name="RibbonTitle"
            ApplicationButtonImageSource="{Binding Source={x:Static CommonProps:Resources.Icon_Mario}, Converter={StaticResource bitmapConverter}}"
            >
            <telerik:RadRibbonBar.ApplicationMenu>
                <telerik:ApplicationMenu RightPaneVisibility="Collapsed">
                    <telerik:RadRibbonButton Text="Select/Change Xxxxx/Xxxxx" Click="Xxxxx_Click" />
                    <telerik:RadRibbonButton Text="Close" Click="CloseApplication"/>
                </telerik:ApplicationMenu>
            </telerik:RadRibbonBar.ApplicationMenu>
               <telerik:RadRibbonBar.QuickAccessToolBar >
                <telerik:QuickAccessToolBar >
                     
                    <telerik:RadRibbonButton Text="Export" Size="Small" Command="{Binding ExportToExcelCommand}"
                                                IsEnabled="{Binding ExportToExcelEnabled, UpdateSourceTrigger=PropertyChanged}"
                                                SmallImage="{Binding Source={x:Static CommonProps:Resources.Icon16_Excel}, Converter={StaticResource bitmapConverter}}"/>
                    <telerik:RadRibbonButton Text="Print" Size="Small" Command="{Binding PrintCommand}"
                                                IsEnabled="{Binding PrintSearchEnabled, UpdateSourceTrigger=PropertyChanged}"
                                                SmallImage="{Binding Source={x:Static CommonProps:Resources.Icon16_Print}, Converter={StaticResource bitmapConverter}}" />
                     
                    </telerik:QuickAccessToolBar>
            </telerik:RadRibbonBar.QuickAccessToolBar>
          </telerik:RadRibbonBar>


This is what i get after a couple hours, tha bad thing about this is that the quicklaunch and the minimize, close, etc buttons
 dissapears, any idea why?
<Style TargetType="DockPanel" x:Name="mainRegionDockPanel">
        <Setter Property="Background" Value="{DynamicResource titleBackground}"/>
    </Style>
    
     
    <LinearGradientBrush x:Key="titleBackground" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="#FFE1EBF5" Offset="0.396"/>
        <GradientStop Color="#FFE1EBF5" Offset="1"/>
        <GradientStop Color="#FFC6DFFC" Offset="0.463"/>
        <GradientStop Color="#FFE1EBF5"/>
        <GradientStop Color="#FFD8E7F7" Offset="0.856"/>
    </LinearGradientBrush>
Martin
Top achievements
Rank 1
 answered on 17 Jun 2011
1 answer
101 views
The following code produces a bar chart showing average request amount grouped by year and type:
          
List<RequestData> produceList = new List<RequestData>();
produceList.Add(new RequestData("2", 132, DateTime.Today, "Cash Grants"));
produceList.Add(new RequestData("1", 145, DateTime.Today.AddYears(1), "Cash Grants"));
produceList.Add(new RequestData("3", 149, DateTime.Today.AddYears(1).AddDays(1), "Cash Grants"));
produceList.Add(new RequestData("4", 187, DateTime.Today, "Cash Grants"));
produceList.Add(new RequestData("5", 186, DateTime.Today.AddYears(1), "Matching Gifts"));
produceList.Add(new RequestData("6", 131, DateTime.Today, "Dinners & Events"));
produceList.Add(new RequestData("7", 173, DateTime.Today.AddYears(1), "Dinners & Events"));
produceList.Add(new RequestData("8", 172, DateTime.Today, "Matching Gifts"));
produceList.Add(new RequestData("9", 140, DateTime.Today.AddYears(1), "Cash Grants"));
produceList.Add(new RequestData("10", 129, DateTime.Today, "Dinners & Events"));
produceList.Add(new RequestData("11", 158, DateTime.Today, "Matching Gifts"));
produceList.Add(new RequestData("12", 164, DateTime.Today.AddYears(1).AddDays(1), "Dinners & Events"));
 
SeriesMapping seriesMapping = new SeriesMapping();
seriesMapping.SeriesDefinition = new HorizontalBarSeriesDefinition();
seriesMapping.GroupingSettings.GroupDescriptors.Add(new ChartGroupDescriptor("Type"));
seriesMapping.GroupingSettings.GroupDescriptors.Add(new ChartYearGroupDescriptor("RequestDate"));
seriesMapping.ItemMappings.Add(new ItemMapping("RequestAmount", DataPointMember.YValue, ChartAggregateFunction.Sum));
seriesMapping.ItemMappings.Add(new ItemMapping("RequestDate", DataPointMember.XCategory));
radChart.SeriesMappings.Add(seriesMapping);
radChart.ItemsSource = produceList;
radChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "yyyy";

However, if I change the order of the data so that item 12 comes directly after item 3 like so:
List<RequestData> produceList = new List<RequestData>();
produceList.Add(new RequestData("2", 132, DateTime.Today, "Cash Grants"));
produceList.Add(new RequestData("1", 145, DateTime.Today.AddYears(1), "Cash Grants"));
produceList.Add(new RequestData("3", 149, DateTime.Today.AddYears(1).AddDays(1), "Cash Grants"));
produceList.Add(new RequestData("12", 164, DateTime.Today.AddYears(1).AddDays(1), "Dinners & Events"));
produceList.Add(new RequestData("4", 187, DateTime.Today, "Cash Grants"));
produceList.Add(new RequestData("5", 186, DateTime.Today.AddYears(1), "Matching Gifts"));
produceList.Add(new RequestData("6", 131, DateTime.Today, "Dinners & Events"));
produceList.Add(new RequestData("7", 173, DateTime.Today.AddYears(1), "Dinners & Events"));
produceList.Add(new RequestData("8", 172, DateTime.Today, "Matching Gifts"));
produceList.Add(new RequestData("9", 140, DateTime.Today.AddYears(1), "Cash Grants"));
produceList.Add(new RequestData("10", 129, DateTime.Today, "Dinners & Events"));
produceList.Add(new RequestData("11", 158, DateTime.Today, "Matching Gifts"));
 
SeriesMapping seriesMapping = new SeriesMapping();
seriesMapping.SeriesDefinition = new HorizontalBarSeriesDefinition();
seriesMapping.GroupingSettings.GroupDescriptors.Add(new ChartGroupDescriptor("Type"));
seriesMapping.GroupingSettings.GroupDescriptors.Add(new ChartYearGroupDescriptor("RequestDate"));
seriesMapping.ItemMappings.Add(new ItemMapping("RequestAmount", DataPointMember.YValue, ChartAggregateFunction.Sum));
seriesMapping.ItemMappings.Add(new ItemMapping("RequestDate", DataPointMember.XCategory));
radChart.SeriesMappings.Add(seriesMapping);
radChart.ItemsSource = produceList;
radChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "yyyy";

I get a bar chart with two groupings for the year 2012. Is this a bug or am I doing something wrong?
Tsvetie
Telerik team
 answered on 17 Jun 2011
2 answers
132 views
I would like my GiridView to display a single row that cannot be stretched vertically by it's contents. I tried setting the TextWrapping and TextTrimming properties on the GridViewDataColumn, but it only seems to apply to the very first line of text. If the value contains carraige returns, then the cell grows vertically. I want to have all uniform one line entries.

Thanks,
Rod
Rod Yager
Top achievements
Rank 1
 answered on 17 Jun 2011
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
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
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
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?