Telerik Forums
UI for WPF Forum
1 answer
156 views
I'm trying to set both background an HorizontalAlignment on GridViewCells of a GridViewDataColumn at run time as follows:

Binding backgroundBinding = new Binding("Item.Format[" + column.UniqueName + "].Background");
Binding horizontalAlignmentBinding  = new Binding("Item.Format[" + column.UniqueName + "].HorizontalAlignment");

Style cellStyle = new Style(typeof(GridViewCell));
cellStyle.Setters.Add(new Setter(GridViewCell.BackgroundProperty, backgroundBinding));
cellStyle.Setters.Add(new Setter(GridViewCell.HorizontalAlignmentProperty, horizontalAlignmentBinding));
column.CellStyle = cellStyle

It works;  the point is that background color do not fill whole cell area but only a around cell content (see attached picture).
Same issue for VerticalAlignment.

Sincerely
Ivano
Milan
Telerik team
 answered on 22 Jul 2010
9 answers
256 views
Hello -
We have a column in a radgridview that is using a rectangle in the data template (WPF 3.5 app - Moving to .NET 4.0 is not a option right now.). This works fine normally, but running a VS 2010 Coded UI Test against the app when this grid is displayed causes our application to crash due to a null reference exception being thrown. Please advise.

Note: This causes our application to crash during QTP automated UI tests (what we normally use for automated UI testing) as well, so our automated testing in on hold until a fix is found.

By the way, UISpy doesn't like this either, but Snoop doesn't seem to have a problem with it.
Thanks.

GridView Column code:

<

 

telerik:GridViewColumn Header="" IsSortable="False" IsFilterable="False" TextAlignment="Center">

 

 

 

<telerik:GridViewColumn.CellTemplate>

 

 

 

<DataTemplate>

 

 

 

<Rectangle Height="18" Width="18"

 

 

HorizontalAlignment="Center" VerticalAlignment="Center"

 

 

Fill="AliceBlue"/>

 

 

 

</DataTemplate>

 

 

 

</telerik:GridViewColumn.CellTemplate>

 

 

 

</telerik:GridViewColumn>

 

 

 

Exception detail:

Event Type: Error
Event Source: RATS 3.0
Event Category: None
Event ID: 100
Date:  7/8/2010
Time:  11:26:50 AM
User:  N/A
Computer: 
Description:
Timestamp: 08-Jul-2010 3:26:50 PM
Message: HandlingInstanceID: c590513b-d517-41bf-88b5-b1304b1daab7
An exception of type 'System.NullReferenceException' occurred and was caught.
-----------------------------------------------------------------------------
07/08/2010 11:26:50
Type : System.NullReferenceException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Object reference not set to an instance of an object.
Source : PresentationCore
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : Void EnsureChildren()
Stack Trace :    at System.Windows.Automation.Peers.AutomationPeer.EnsureChildren()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateChildren()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.ContextLayoutManager.fireAutomationEvents()
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
   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.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)
   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, 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 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.Threading.Dispatcher.Run()
   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 WpfShell.App.Main() in C:\IS\TFSProd\CSS.Underwriting\Main\Rats3\Client\WpfShell\obj\Debug\App.g.cs:line 0

 

 

Milan
Telerik team
 answered on 22 Jul 2010
1 answer
120 views
im having a popup which contains two grid. when i placed code in separate xaml it works perfect. but when i placed the inside a popup. my popup info Content appear quit away from where my mouse pointer is. u can see attached image.

so how to position my info Contents under my mouse?
Miroslav
Telerik team
 answered on 21 Jul 2010
1 answer
169 views
Hello,
I'm having issues getting the treeview's functionalities to work when in LoadOnDemand , notably drag and drop and AutoExpand,
1) AutoExpand on drag doesn't work , if i remove the load on demand it works , however load on demand itself seems to work just fine
2) Droping doesn't seem to load the node either , when i drop on an unloaded node it opens with only the node i have droped instead of it's actual content.
Is this scenario supported, if so what am i doing wrong , else any tips on how to implement it? I am using the latest Q2 version and WPF 4 / VS 2010.
Thanks!

Full code (couldn't find how to properly paste code on forums , any tips most welcome):

XAML :

<

 

 

Window x:Class="RadControlsWpfApp1.MainWindow"

 

 

 

 

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

 

 

 

 

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

 

 

 

 

xmlns:Tree="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"

 

 

 

 

Title="MainWindow" Height="350" Width="525">

 

 

 

 

 

<Grid>

 

 

 

 

 

<!--If you uncomment the line , autoexpand works just fine-->

 

 

 

 

 

<Tree:RadTreeView ItemsSource="{Binding Items}"

 

 

 

 

IsLoadOnDemandEnabled="True"

 

 

 

 

LoadOnDemand="RadTreeView_LoadOnDemand"

 

 

 

 

IsDragDropEnabled="True">

 

 

 

 

 

<Tree:RadTreeView.ItemTemplate>

 

 

 

 

 

<HierarchicalDataTemplate ItemsSource="{Binding Children}">

 

 

 

 

 

<TextBlock Text="{Binding Name}"></TextBlock>

 

 

 

 

 

</HierarchicalDataTemplate>

 

 

 

 

 

</Tree:RadTreeView.ItemTemplate>

 

 

 

 

 

</Tree:RadTreeView>

 

 

 

 

 

</Grid>

 

</

 

 

 

Window>

 

 


Code behind:

using

 

 

System;

 

 

using

 

 

System.Collections.Generic;

 

 

using

 

 

System.Windows;

 

 

using

 

 

System.Windows.Navigation;

 

 

using

 

 

Telerik.Windows.Controls;

 

 

using

 

 

System.ComponentModel;

 

 

namespace

 

 

RadControlsWpfApp1

 

{

 

 

 

public partial class MainWindow : Window

 

 

{

 

 

public MainWindow()

 

{

InitializeComponent();

 

 

 

this.DataContext = this;

 

Items =

 

 

new List<object>(){

 

 

 

 

new Item{Id = 1 , Name = "1"},

 

 

 

 

new Item{Id = 2 , Name = "2"},

 

 

 

 

new Item{Id = 3 , Name = "3"},

 

 

 

 

new Item{Id = 4 , Name = "4"},

 

 

 

 

new Item{Id = 5 , Name = "5"}

 

};

}

 

 

 

public List<object> Items { get; set; }

 

 

 

 

private void RadTreeView_LoadOnDemand(object sender, Telerik.Windows.RadRoutedEventArgs e)

 

{

 

 

 

RadTreeViewItem item = e.OriginalSource as RadTreeViewItem;

 

 

 

 

var Current = item.Item as Item;

 

Current.Children =

 

 

new List<object>(){

 

 

 

 

new Item{Id = 1 , Name = "1"},

 

 

 

 

new Item{Id = 2 , Name = "2"},

 

 

 

 

new Item{Id = 3 , Name = "3"},

 

 

 

 

new Item{Id = 4 , Name = "4"},

 

 

 

 

new Item{Id = 5 , Name = "5"}

 

};

item.IsLoadingOnDemand =

 

 

false;

 

}

}

 

 

 

public class Item : INotifyPropertyChanged

 

 

{

 

 

public int Id { get; set; }

 

 

 

 

public string Name { get; set; }

 

 

 

 

List<object> children = new List<object>();

 

 

 

 

public List<object> Children

 

{

 

 

 

get

 

 

{

 

 

return children;

 

}

 

 

 

set

 

 

{

children =

 

value;

 

PropertyChange(

 

 

"Children");

 

}

}

 

 

 

 

public event PropertyChangedEventHandler PropertyChanged = (a, b) => { };

 

 

 

 

public void PropertyChange(string propertyName)

 

{

 

 

 

this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));

 

}

}

}

 

Miroslav
Telerik team
 answered on 21 Jul 2010
1 answer
450 views
If I put a
<telerik:RadTransitionControl />
element on the windows I am starting to get these kind of errors:

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=Foreground.Color; DataItem=null; target element is 'DropShadowEffect' (HashCode=31421563); target property is 'Color' (type 'Color')

Note that transition control is empty (no content) and the error originates from a style I have somewhere defined. I assume transition control does something with styles.
Not also that this isn't a stopping error but rather an annoyance in output window.
George
Telerik team
 answered on 21 Jul 2010
2 answers
107 views
Hi, I'm using Xaml to design my PanelBar. I want to set defined properties to my PanelBarItems when they are expanded and when they are selected. I found some code on an other thread but it doesn't seem to be compatible with the PanelBar. Here is the code:
<Style TargetType="{x:Type telerik:RadPanelBarItem}">
                <Setter Property="HeaderTemplate">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type telerik:RadPanelBarItem}">
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter Property="FontSize" Value="25" />
                                </Trigger>
                                <Trigger Property="IsExpanded" Value="True">
                                    <Setter Property="FontWeight" Value="Italic" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

Can you tell me how to set the HeaderTemplate and his trigger?
I'm using WPF controls Q2 2010
Thanks
Jean-Francois
Top achievements
Rank 1
 answered on 21 Jul 2010
9 answers
172 views
Hello,
I am trying to call the following code during the Loaded event and it does not work:

Carousel.CarouselItem item = (Carousel.CarouselItem)Scenes.Children[3]; 
Scenes.BringItemIntoView(item, true); 

I have similar code being called for the MouseDown event and it works fine. I know that I can call the .MoveBy method, but I'd like to move to a particular item in the list. Please not that I am using a CarouselPanel with custom UserControl as the child nodes.
Scott
Top achievements
Rank 1
 answered on 21 Jul 2010
2 answers
342 views
How can we load an image from SQL database (image stored as byte array) in image colum of gridview.
the grid binding is done through the .net datatable. Is it possible in this manner? if it is possible can i get a code sample...

thanx in advance...

expecting your valuable reply...

Regards
Abhijith
Ahmet Özgür
Top achievements
Rank 1
 answered on 21 Jul 2010
4 answers
447 views
hi,
i tried to add a new row in a editing gridview,
when I click on the InsertRow, it becomes an edit row
and I can edit.
but when I go out the row, it disappears from the gridview,
it remains in the ChangeSet object, and after SubmitChanges it added to the data.
I want to see the new row immediately after insertion, not just after the SubmitChanges function.
i'd love to see an example where it works
thanks.
Ahmet Özgür
Top achievements
Rank 1
 answered on 21 Jul 2010
1 answer
129 views
Hello,

I am trying to adjust the RadCarousel in such a manner, that everytime the ItemsSource property of the carousel changes, it would run the animation that usually starts when items are added statically in XAML. I've tried several variations of MoveBy, PageLeft, PageLeft, etc. and calling BringDataItemIntoView, but i never get the desired result. Most of the time the items just appear or swirl around uncoherently.
Could there be some sort of workaround to make this work?

To wrap it up, i want the carousel to animate the items everytime i change the ItemsSource collection.
Any help would be greatly appreciated,
Thanks

Edit: My project is in WPF, of course :)
Maya
Telerik team
 answered on 21 Jul 2010
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
Slider
Expander
TileList
PersistenceFramework
DataPager
TimeBar
Styling
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
WebCam
CardView
DataBar
FilePathPicker
Licensing
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?