Telerik Forums
UI for WPF Forum
2 answers
131 views
I'm trying to get a subproperty formatted, but it doesn't seem to be working. It's just showing the value without any formatting.

My xaml:

<Window x:Class="GridFormatTest.MainWindow" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        Title="MainWindow" Height="350" Width="525" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:System="clr-namespace:System;assembly=mscorlib"
    <Grid Loaded="Grid_Loaded"
        <telerik:RadGridView HorizontalAlignment="Left" Name="radGridView1" VerticalAlignment="Top" Height="311" Width="503"
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn Header="Works" DataMemberBinding="{Binding Size}" DataFormatString="{}{0:N}"/> 
                <telerik:GridViewDataColumn Header="Doesn't work" DataMemberBinding="{Binding SubItem.SubSize}" DataFormatString="{}{0:N}" DataType="{x:Type System:Double}"/> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 
    </Grid> 
</Window> 

The code:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Data; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Imaging; 
using System.Windows.Navigation; 
using System.Windows.Shapes; 
 
namespace GridFormatTest 
    public class Order 
    { 
        public Order() 
        { 
            this.Size = 12000.0; 
            this.SubItem = new SubOrder(); 
        } 
 
        public double Size { getprivate set; } 
 
        public SubOrder SubItem { getset; } 
    } 
 
    public class SubOrder 
    { 
        public SubOrder() 
        { 
            this.SubSize = 150000; 
        } 
 
        public double SubSize { getset; } 
    } 
 
    /// <summary> 
    /// Interaction logic for MainWindow.xaml 
    /// </summary> 
    public partial class MainWindow : Window 
    { 
        public MainWindow() 
        { 
            InitializeComponent(); 
        } 
 
        private void Grid_Loaded(object sender, RoutedEventArgs e) 
        { 
            radGridView1.ItemsSource = new List<Order> 
            { 
                new Order(), 
                new Order() 
            }; 
        } 
    } 

As you can see I've also tried to set the DataType manually, which I noticed was the solution to another similar problem I found on the forums. But that doesn't help.

Any suggestions?
Yordanka
Telerik team
 answered on 15 Apr 2010
1 answer
227 views
I am using nested tabs and styling my high-level tabs not to look like tabs. They are more like a simple header link list. The styling has worked fine, was easy, but I would like to change the fontweight to bold on mouseover. Here is the section of code I am using. The styling of the IsSelected states is working fine, but I can't get the IsMouseOver styling to work. What am I doing wrong?


 

 

<ControlTemplate.Triggers>

 

 

 

<Trigger Property="IsMouseOver" Value="True">

 

 

 

<Setter Property="Stroke" TargetName="OuterPath" Value="#6600BCFF"/>

 

 

 

<Setter Property="Stroke" TargetName="OuterFill" Value="#6600BCFF"/>

 

 

 

<Setter Property="FontWeight" TargetName="HeaderElement" Value="Bold"/>

 

 

 

<Setter Property="FontSize" TargetName="HeaderElement" Value="16"/>

 

 

 

<Setter Property="Foreground" TargetName="HeaderElement" Value="Blue"/>

 

 

 

<Setter Property="Background" TargetName="InnerFill">

 

 

 

<Setter.Value>

 

 

 

<LinearGradientBrush EndPoint="0.500008,0" StartPoint="0.500008,1.00006">

 

 

 

<GradientStop Color="#FFE3F6FF" Offset="0"/>

 

 

 

<GradientStop Color="#FFBFEAFF" Offset="1"/>

 

 

 

</LinearGradientBrush>

 

 

 

</Setter.Value>

 

 

 

</Setter>

 

 

 

<Setter Property="Fill" TargetName="InnerPath">

 

 

 

<Setter.Value>

 

 

 

<LinearGradientBrush EndPoint="0.500008,0" StartPoint="0.500008,1.00006">

 

 

 

<GradientStop Color="#FFE3F6FF" Offset="0"/>

 

 

 

<GradientStop Color="#FFBFEAFF" Offset="1"/>

 

 

 

</LinearGradientBrush>

 

 

 

</Setter.Value>

 

 

 

</Setter>

 

 

 

</Trigger>

 

 

 

<Trigger Property="IsSelected" Value="False">

 

 

 

<Setter Property="Stroke" TargetName="OuterPath">

 

 

 

<Setter.Value>

 

 

 

<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

 

 

 

<GradientStop Color="#4000BCFF" Offset="0"/>

 

 

 

<GradientStop Color="#6600BCFF" Offset="1"/>

 

 

 

</LinearGradientBrush>

 

 

 

</Setter.Value>

 

 

 

</Setter>

 

 

 

<Setter Property="Stroke" TargetName="OuterFill">

 

 

 

<Setter.Value>

 

 

 

<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

 

 

 

<GradientStop Color="#4000BCFF" Offset="0"/>

 

 

 

<GradientStop Color="#6600BCFF" Offset="1"/>

 

 

 

</LinearGradientBrush>

 

 

 

</Setter.Value>

 

 

 

</Setter>

 

 

 

<Setter Property="Background" TargetName="InnerFill" Value="Transparent"/>

 

 

 

<Setter Property="Fill" TargetName="InnerPath" Value="White"/>

 

 

 

<Setter Property="Margin" TargetName="wrapper" Value="0,0,-10,-2"/>

 

 

 

<Setter Property="Foreground" TargetName="HeaderElement" Value="Blue"/>

 

 

 

<Setter Property="FontWeight" TargetName="HeaderElement" Value="Normal"/>

 

 

 

<Setter Property="FontSize" TargetName="HeaderElement" Value="16"/>

 

 

 

<Setter Property="Margin" TargetName="HeaderElement" Value="2"/>

 

 

 

<Setter Property="Cursor" Value="Hand"/>

 

 

 

</Trigger>

 

 

 

 

<Trigger Property="IsSelected" Value="True">

 

 

 

<Setter Property="Stroke" TargetName="OuterPath">

 

 

 

<Setter.Value>

 

 

 

<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

 

 

 

<GradientStop Color="#4000BCFF" Offset="0"/>

 

 

 

<GradientStop Color="#6600BCFF" Offset="1"/>

 

 

 

</LinearGradientBrush>

 

 

 

</Setter.Value>

 

 

 

</Setter>

 

 

 

<Setter Property="Stroke" TargetName="OuterFill">

 

 

 

<Setter.Value>

 

 

 

<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

 

 

 

<GradientStop Color="#4000BCFF" Offset="0"/>

 

 

 

<GradientStop Color="#6600BCFF" Offset="1"/>

 

 

 

</LinearGradientBrush>

 

 

 

</Setter.Value>

 

 

 

</Setter>

 

 

 

<Setter Property="Background" TargetName="InnerFill" Value="Transparent"/>

 

 

 

<Setter Property="Fill" TargetName="InnerPath" Value="White"/>

 

 

 

<Setter Property="Margin" TargetName="wrapper" Value="0,0,-10,-2"/>

 

 

 

<Setter Property="Foreground" TargetName="HeaderElement" Value="#262626"/>

 

 

 

<Setter Property="FontWeight" TargetName="HeaderElement" Value="Bold"/>

 

 

 

<Setter Property="FontSize" TargetName="HeaderElement" Value="16"/>

 

 

 

<Setter Property="Margin" TargetName="HeaderElement" Value="2"/>

 

 

 

</Trigger>

 

 

 

<Trigger Property="IsEnabled" Value="False">

 

 

 

<Setter Property="Opacity" TargetName="HeaderElement" Value="0.5"/>

 

 

 

</Trigger>

 

 

 

</ControlTemplate.Triggers>

 

Dimitrina
Telerik team
 answered on 15 Apr 2010
1 answer
94 views
Hello All,

   In the private bool Telerik.Windows.Controls.GridView.GridViewDataControl.Move(FocusNavigationDirection navigationDirection) method, there is an unchecked condition in the FocusNavigationDirection.Next and Previous switch condition that throws a NullRefereceException.  Below is the code snippet:

      switch (navigationDirection)  
      {  
        case FocusNavigationDirection.Next:  
        case FocusNavigationDirection.Previous:  
          if (!this.CurrentCell.IsInEditMode)  
          { //...  
 

I know its a bug because just below that is the proper form of the condition that checks this.CurrentCell for null:
        case FocusNavigationDirection.Left:  
        case FocusNavigationDirection.Right:  
        case FocusNavigationDirection.Up:  
        case FocusNavigationDirection.Down:  
          currentCellContainer = this.OnArrowKeyDown(this.CurrentCell, navigationDirection);  
          if ((this.CurrentCell != null) && this.CurrentCell.IsInEditMode)  
          { //...  
 

- Rashad Rivera
  omegusprime.com
Vlad
Telerik team
 answered on 15 Apr 2010
6 answers
326 views
Default setting for the EditTriggers in the DataGrid is "Mouse DoubleClick". However I want to be able to edit the cells if either of the following events happen:

1. Enter Key Press
2. Mouse DoubleClick
3. F2 Key Press

Can you tell me how to do this? I didn't find anything in the documentation regarding this.
Nedyalko Nikolov
Telerik team
 answered on 14 Apr 2010
9 answers
112 views
Hi There,

I'm trying to find a way to have a text appear in the body of the GridView (where the background color appears) whenever the grid does not contain any rows (something like "The list is empty, click on XXX to add something!"). I could think of a few ways to do this, but was wondering if there is some kind of recommended way.

What do you guys say?

Thanks,
yonadav
Pavel Pavlov
Telerik team
 answered on 14 Apr 2010
6 answers
92 views
Hello!

I have problem with RadGridView grouping.

<telerikGrid:RadGridView x:Name="InmattVolymGridView" Language="sv-SE" AutoGenerateColumns="False"         
                                         ShowColumnFooters="True"
                                         VerticalAlignment="Top"
                                         ItemsSource="{Binding InmattaVolymer, ValidatesOnDataErrors=True, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                                         Validation.ErrorTemplate="{DynamicResource validationTemplate}"
                                         ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors).CurrentItem.ErrorContent}" >
                   
                    <telerikGrid:RadGridView.Columns>
                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding Sortiment}" Header="Sortiment" Width="85"/>
                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding InmattM3F}" Header="m3f Inmätt" Width="100" >
                            <telerikGrid:GridViewDataColumn.AggregateFunctions>
                                <telerikData:SumFunction SourceField="InmattM3F" />
                            </telerikGrid:GridViewDataColumn.AggregateFunctions>
                        </telerikGrid:GridViewDataColumn>
                        <telerikGrid:GridViewDataColumn DataMemberBinding="{Binding SortimentTyp}" Header="Sortimenttyp" Width="85"/>
                    </telerikGrid:RadGridView.Columns>
                    <telerikGrid:RadGridView.GroupDescriptors>
                        <telerikData:GroupDescriptor SortDirection="Ascending" Member="SortimentTyp">
                            <telerikData:GroupDescriptor.AggregateFunctions>
                                <telerikData:CountFunction Caption="Total volym:" />
                            </telerikData:GroupDescriptor.AggregateFunctions>
                        </telerikData:GroupDescriptor>
                    </telerikGrid:RadGridView.GroupDescriptors>
                 </telerikGrid:RadGridView>

I get 'Invalid Property or Field' on Member in GroupDescription. How should I connect the grouping to the column.

Best regards / Anna
Rudis
Top achievements
Rank 1
 answered on 14 Apr 2010
1 answer
98 views
Two questions into one....

1: Can I customize the style of the scrollbars when using the scrolling/zooming features
2: Can I make it so that the width of the bars are fixed?

I'm trying to make a chart where there are a larger number elements that can be scrolled through (keeping the Y-Axis fixed).

Thanks!

Sia
Telerik team
 answered on 14 Apr 2010
2 answers
383 views
Hi,

I'm trying to bind the background of a GridViewDataColumn to a property in my ViewModel:
<radGrid:GridViewDataColumn Header="State" Width="090" Background="{Binding Path=State, Converter={StaticResource StateToColorConverter}}" DataMemberBinding="{Binding Path=State}"/> 

Based on the value of the State property the background should change: if State = new, the background should be green, if State = rejected the value should be red, and so on.
However, if I bind the State property to the Background, i get a BindingExpression path error stating that my State property is not found on my object, while the same databinding works fine on the DataMemberBinding.
Anyone got a clue what is wrong here?

The Xaml:
<radGrid:RadGridView ItemsSource="{Binding Orders}" > 
     <radGrid:RadGridView.Columns> 
          <radGrid:GridViewDataColumn Header="State" Width="090" 
                                     
Background="{Binding Path=State, Converter={StaticResource StateToColorConverter}}" 
                                     
DataMemberBinding="{Binding Path=State}"/>  
     </radGrid:RadGridView.Columns> 
</radGrid:RadGridView> 

and the code from the viewModel:
private ObservableCollection<SingleOrder> _orders = new ObservableCollection<SingleOrder>()  
public ObservableCollection<SingleOrder> Orders { get { return _orders; } }  
 
public class SingleOrder   
        : ViewModelBase  
{  
        private Instrument _instrument;  
        public Instrument Instrument  
        {  
            get { return _instrument; }  
            set 
            {  
                if (!Instrument.Equals(_instrument, value))  
                {  
                    _instrument = value;  
                    this.OnPropertyChanged("Instrument");  
                }  
            }  
        }  
 
        private System.String _state;  
        public System.String State  
        {  
            get { return _state; }  
            set 
            {  
                if (!String.Equals(_state, value))  
                {  
                    _state = value;  
                    this.OnPropertyChanged("State");  
 
                }  
            }  
        }  
}  
 

Thanks a lot!

Hans
Hans Smit
Top achievements
Rank 1
 answered on 14 Apr 2010
1 answer
358 views
Not a question this time. I just thought I might post this in case it is of help to others playing with the RadMap.
 
This is how to add images to the radmap map with a bit more control over the image than is available by simply adding a bitmap using the pinpoint method.

        // Set provider
                BingMapProvider provider = new BingMapProvider(MapMode.Aerial, true, "YOUR CODE GOES HERE");
                provider.IsTileCachingEnabled = true;
                mWindow.radmap.Provider = provider;

        // Create information layer
                iLayer = new InformationLayer();
                iLayer.MapControl = mWindow.radmap;
                mWindow.radmap.Items.Add(iLayer);

        // Create a new image object and add it to bing map.
                Uri uri = new Uri(@"" + imageName, UriKind.Relative);

                BitmapImage bitmap = new BitmapImage();
                bitmap.BeginInit();
                bitmap.UriSource = uri;
                bitmap.EndInit();

                Image image = new Image();
                image.Source = bitmap;
                image.Opacity = 0.85;
                image.Width = imageWidth;
                image.Height = imageHeight;
                image.Stretch = Stretch.UniformToFill;
                image.SnapsToDevicePixels = true;
                image.Name = Name;

        // When added to map, centre image over Lat/Long rather than use upper left corner for placement
                image.VerticalAlignment = VerticalAlignment.Center;
                image.HorizontalAlignment = HorizontalAlignment.Center;

        // Add the image to the map
                MapLayer.SetLocation(image, new Location(dLatitude, dLongitude));
                iLayer.Items.Add(image);

Andrey
Telerik team
 answered on 14 Apr 2010
1 answer
83 views

Hello!

I’m working with your Chart, and I found it working incorrectly.

<QuickStart:ExampleControl x:Class="Telerik.Windows.Examples.Chart.WPF.TwoDimensional.Bar.Example"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:QuickStart="clr-namespace:Telerik.Windows.QuickStart;assembly=Telerik.Windows.QuickStart"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
    <Grid>     
        <telerik:RadChart x:Name="RadChart1"/>
    </Grid>
</QuickStart:ExampleControl>

As a result I expect to see a Chart of 0x0 size, but instead it’s 800x600.
I do not understand where this size comes from, because it’s not written anywhere.
How can I solve that problem?
The matter is crucial for me, since in my application I need to implement the floating layout.
Thank you very much.

RadarSoft

Velin
Telerik team
 answered on 14 Apr 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?