Telerik Forums
UI for WPF Forum
0 answers
92 views

 

 

 

 Resolved.

Hemal
Top achievements
Rank 1
 asked on 17 Aug 2009
3 answers
192 views
I can display the data how I want it with my custom column headers and such. However, I have some columns in my child tables I'd like to have aggregates on and display in a footer in the child table. Can this be done?

Thanks,
Byron
Vlad
Telerik team
 answered on 17 Aug 2009
3 answers
304 views
Hello,
I'm having troubles with the aggregate functions. On the examples that I have found when you group a column the collapsed row has whatever caption is on the GroupFooters and they seem to be left justified.
on the one I'm working with they display but they seem to be pushed to the right. I can't seem to find a way to position them to the left.

<telerik:RadGridView   
                Name="rgv"    
                Grid.Row="1"   
                Margin="10,5,10,5" 
                telerik:StyleManager.Theme="Office_Blue"   
                ShowColumnFooters="True"   
                ShowGroupFooters="True" 
                IsReadOnly="True"   
                AutoGenerateColumns="False" 
                ColumnsWidthMode="Auto" 
                ItemsSource="{Binding Source={StaticResource DataProvider}}">  
                <telerik:RadGridView.Columns> 
                    <telerik:GridViewDataColumn Header="ID" DataMemberPath="ID"  > 
                        <telerik:GridViewColumn.AggregateFunctions> 
                            <telerik:CountFunction Caption="Count:" /> 
                        </telerik:GridViewColumn.AggregateFunctions> 
                    </telerik:GridViewDataColumn> 
                    <telerik:GridViewDataColumn Header="Desc" DataMemberPath="Desc"  /> 
                    <telerik:GridViewDataColumn Header="Purchase Date" DataMemberPath="Purch_Date"  DataFormatString="{}{d}" /> 
                    <telerik:GridViewDataColumn Header="Purchase Price" DataMemberPath="Purch_Price" DataFormatString="{}{0:c}" > 
                        <telerik:GridViewColumn.AggregateFunctions> 
                            <telerik:SumFunction Caption="Sum:" ResultFormatString="{}{0:c}" SourceField="Purch_Price" /> 
                        </telerik:GridViewColumn.AggregateFunctions> 
                    </telerik:GridViewDataColumn> 
                    <telerik:GridViewDataColumn Header="Disposal Date" DataMemberPath="Disp_Date" DataFormatString="{}{d}" /> 
                    <telerik:GridViewDataColumn Header="Disposal Price" DataMemberPath="Disp_Price" > 
                        <telerik:GridViewColumn.AggregateFunctions> 
                            <telerik:SumFunction Caption="Disp Sum:" ResultFormatString="{}{0:c}" SourceField="Disp_Price" /> 
                        </telerik:GridViewColumn.AggregateFunctions> 
                    </telerik:GridViewDataColumn> 
                    <telerik:GridViewDataColumn Header="Type" DataMemberPath="Type" /> 
                    <telerik:GridViewDataColumn Header="Tax" DataMemberPath="Tax" /> 
                    <telerik:GridViewDataColumn Header="Status" DataMemberPath="Status" /> 
                    <telerik:GridViewDataColumn Header="Property Type" DataMemberPath="Property_Type" /> 
                </telerik:RadGridView.Columns> 
            </telerik:RadGridView> 

After grouping the type column i get somthing like
1503                                                           |  Count: 56                        |  Sum: $1,978.1     and the rest is cut off

Thanks much,
~Boots
Missing User
 answered on 14 Aug 2009
7 answers
814 views
I have a RadTreeView with HierarchicalDataTemplate as follows:

<HierarchicalDataTemplate DataType="Category" ItemsSource="{Binding XPath=Category}"
   <TextBlock x:Name="tbCategoryName" Text="{Binding XPath=@Name}" MouseRightButtonUp="tbCategoryName_MouseRightButtonUp" 
                           MouseDown="tbCategoryName_MouseDown"
   </TextBlock> 
</HierarchicalDataTemplate> 

I need access to the RadTreeViewItem so that I can call methods and properties such as BeginEdit, ExpandAll, and IsExpanded.
This is my RadTreeView declaration:

        <telerik:RadTreeView ItemsSource="{Binding Source={StaticResource CategoriesXML}}" Margin="105,64,0,0"  
                             Name="tvOntology" HorizontalAlignment="Left" VerticalAlignment="Top" Width="200" 
                             IsEditable="True" IsEnabled="True" IsExpandOnDblClickEnabled="False"  
                             IsExpandOnSingleClickEnabled="True"
        </telerik:RadTreeView> 
 
It works fine but I'm not able to get the RadTreeViewItem. Could someone tell me how, please?
Tim
Top achievements
Rank 1
 answered on 14 Aug 2009
10 answers
434 views
Hello,
I encountered a problem with the GridView WPF-Control. When I use a Converter in the DataMemberBinding of a column and group by that column, the result will be grouped by the unconverted value.

To show the problem, i set up a small test project with a small "Person" class with "Name" (string), "Age" (int) and "Status" (int) properties.
In the test project, three persons-objects will be created and bound to a GridView. Each property in a seperate column.
The "Status" column uses a converter for the DataMemberBinding:
<Window x:Class="RadGridViewColumnTest.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    xmlns:System="clr-namespace:System;assembly=mscorlib"         
    xmlns:local="clr-namespace:RadGridViewColumnTest" 
    Title="Window1" Height="300" Width="300"
    <Grid> 
        <Grid.Resources> 
            <local:StatusConverter x:Key="StatusConverterResource"
            </local:StatusConverter> 
        </Grid.Resources> 
        <telerik:RadGridView x:Name="grid" AutoGenerateColumns="False" Grouping="grid_Grouping"
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn HeaderText="Person" DataMemberBinding="{Binding .Name}" DataType="{x:Type System:String}"
                </telerik:GridViewDataColumn> 
                <telerik:GridViewDataColumn HeaderText="Age" DataMemberBinding="{Binding .Age}" DataType="{x:Type System:Int32}"/> 
                <telerik:GridViewDataColumn HeaderText="Status" DataMemberBinding="{Binding  Path=Status, Converter={StaticResource StatusConverterResource}}" IsSortable="True" DataType="{x:Type System:Int32}" IsGroupable="True"/> 
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 
    </Grid> 
</Window> 
 

public class StatusConverter : IValueConverter 
    { 
        #region IValueConverter Members 
 
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
        { 
            if ((int)value < 256) 
            { 
                return "< 256"
            } 
            else 
                return ">= 256"
 
        } 
 
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
        { 
            throw new NotImplementedException(); 
        } 
        #endregion 
    } 

The Status of the three persons are 122, 123, 321, and they appear correctly converted in the list.
Obviously the result, after a group by Status, should show the persons with Status 123 and 123 in one group because their Status is below 256.
But it seems the converter won't be used for grouping and every person appear in a single group.
Is there a solution for this problem ?

Thanks,  Michael
Michael
Top achievements
Rank 1
 answered on 14 Aug 2009
1 answer
88 views
Hi.
I am looking for "the right way" to add new Rows to a GridView...
1. Is there any pre-defined method to add new rows ? (Like the WinForms MS-Grid used to have...)
Something like:
AddNewRowIfUserDoubleClicksTheLeftPane="true" 

2. I am displaying some navigateable Properties which are based on Types of which I know the Interface only..
Something Like:
public class DisplayData  
{  
   public string Name { getset; }  
   public ISomeInterfaceType Prop { getset; }  
}  
  
public interface ISomeInterfaceType  
{  
   string OtherName { get; }  
}  
<telerik:GridViewDataColumn     
     Header="Name"    
     DataMemberBinding="{Binding Path=Name, Mode=OneWay}"    
     Width="2*"    
     IsReadOnly="True"/>    
<telerik:GridViewDataColumn     
     Header="Other"    
     DataMemberBinding="{Binding Path=Prop.OtherName, Mode=OneWay}"  
     DataType="{x:Type sys:String}"  
     Width="3*"    
     IsReadOnly="True"/>
However, I want to be able to let the user add new rows - in which case I need two entered strings (which I check for validity) and afterwards return the new "DisplayData"-Object. Currently I am doing this using a new Window (ShowDialog()) which let's the User input his data...

Can I use the "new-row" feature of the GridView, if some columns are bound to read-only properties or even classes of which I know only the Interface ?

Yours,
Nils


Nedyalko Nikolov
Telerik team
 answered on 14 Aug 2009
1 answer
219 views
I am unable to view the cs code - clicking the tab leaves the xaml.
Valeri Hristov
Telerik team
 answered on 14 Aug 2009
1 answer
470 views
I can't seem to get TwoWay Binding to work with the TabControl SelectedIndex Property,  anybody else get this to work or is it just broken?
XAML Looks like this:
<Controls1:RadTabControl DockPanel.Dock="Top" SelectedIndex="{Binding Path=Header.SelectedTabIndex,Mode=TwoWay}" >
ViewModel Looks like this:
        public int SelectedTabIndex
        {
            get { return _selectedTabIndex; }
            set
            {
                if (_selectedTabIndex != value)
                {
                    _selectedTabIndex = value;
                    RaisePropertyChanged("SelectedTabIndex");
                }
            }
        }
Now, it gets updated if the user clicks a tab, but if its set in the ViewModel, TabControl does nothing...







Using 2009.2.701.35 build
Bobi
Telerik team
 answered on 13 Aug 2009
8 answers
226 views
I am really confused with how to DataBind. I have 2 nearly identical projects, one using LINQ, the other OpenAccess, using only the Categories table from the Northwind database. Basically, a grid (of that table), and 2 textboxes for editing / 2-way binding.

Here is the code for Window1.xaml (LINQ Project):
<Window x:Class="NWLinq.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="clr-namespace:NWLinq" 
    Title="Northwind LINQ" Height="400" Width="575" xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    <Window.Resources> 
        <ObjectDataProvider x:Key="objectDataProvider" ObjectType="{x:Type local:TestViewModel}"  /> 
    </Window.Resources> 
 
    <Grid DataContext="{Binding Source={StaticResource objectDataProvider}}"
        <Grid.ColumnDefinitions> 
            <ColumnDefinition Width="200*" /> 
            <ColumnDefinition Width="300*" /> 
        </Grid.ColumnDefinitions> 
        <Grid.RowDefinitions> 
            <RowDefinition Height="60*" /> 
            <RowDefinition Height="60*" /> 
            <RowDefinition Height="240*" /> 
        </Grid.RowDefinitions> 
        <my:RadGridView  
            Grid.Row="2"  
            Name="radGridView1"  
            Grid.ColumnSpan="2"  
            ColumnsWidthMode="Fill" 
            IsReadOnly="False"  
            SelectedItem="{Binding SelectedItem}" 
            ItemsSource="{Binding CategoryList}"              
        > 
        </my:RadGridView> 
        <TextBlock Margin="91,16,41,10" Name="textBlock1" Text="Name" HorizontalAlignment="Right" VerticalAlignment="Center" /> 
        <TextBlock Margin="91,14,41,8" Name="textBlock2" Grid.Row="1" Text="Description" HorizontalAlignment="Right" VerticalAlignment="Center" /> 
        <TextBox Grid.Column="1" Margin="58,15,64,11" Name="textBox1" Text="{Binding Path=SelectedItem.CategoryName, Mode=TwoWay}"  /> 
        <TextBox Margin="58,14,64,8" Name="textBox2" Grid.Column="1" Grid.Row="1" Text="{Binding Path=SelectedItem.Description, Mode=TwoWay}"  /> 
    </Grid> 
</Window> 
 

and from the OA project:
<Window x:Class="NWOA.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"     
    xmlns:local="clr-namespace:NWOA" 
    Title="Northwind OpenAccess" Height="400" Width="575" > 
    <Window.Resources> 
        <ObjectDataProvider x:Key="objectDataProvider" ObjectType="{x:Type local:TestViewModel}"  /> 
    </Window.Resources> 
 
    <Grid DataContext="{Binding Source={StaticResource objectDataProvider}}"
        <Grid.ColumnDefinitions> 
            <ColumnDefinition Width="200*" /> 
            <ColumnDefinition Width="300*" /> 
        </Grid.ColumnDefinitions> 
        <Grid.RowDefinitions> 
            <RowDefinition Height="60*" /> 
            <RowDefinition Height="60*" /> 
            <RowDefinition Height="240*" /> 
        </Grid.RowDefinitions> 
        <my:RadGridView  
            Grid.Row="2"  
            Name="radGridView1"  
            Grid.ColumnSpan="2"  
            ColumnsWidthMode="Fill" 
            IsReadOnly="False"  
            SelectedItem="{Binding SelectedItem}" 
            ItemsSource="{Binding CategoryList}"              
        > 
        </my:RadGridView> 
        <TextBlock Margin="91,16,41,10" Name="textBlock1" Text="Name" HorizontalAlignment="Right" VerticalAlignment="Center" /> 
        <TextBlock Margin="91,14,41,8" Name="textBlock2" Grid.Row="1" Text="Description" HorizontalAlignment="Right" VerticalAlignment="Center" /> 
        <TextBox Grid.Column="1" Margin="58,15,64,11" Name="textBox1" Text="{Binding Path=SelectedItem.CategoryName, Mode=TwoWay}"  /> 
        <TextBox Margin="58,14,64,8" Name="textBox2" Grid.Column="1" Grid.Row="1" Text="{Binding Path=SelectedItem.Description, Mode=TwoWay}"  /> 
    </Grid> 
</Window> 
 

They should be identical (other than x:Class=...)

The Window1.xaml.cs files are the same (except for the namespace:
using System.Windows; 
 
namespace NWLinq 
    public partial class Window1 : Window 
    { 
        public Window1() 
        { 
            InitializeComponent(); 
        } 
    } 
------- 
 
using System.Windows; 
 
namespace NWOA 
    public partial class Window1 : Window 
    { 
        public Window1() 
        { 
            InitializeComponent(); 
        } 
    } 
 

The viewmodels are as close as can be, based on different requirements for LINQ and OA:
using System.Collections.Generic; 
using System.Linq; 
 
namespace NWLinq 
    public class TestViewModel 
    { 
        NWLinqDataContext dc = new NWLinqDataContext(); 
        public TestViewModel() 
        { 
            SetTable(); 
        } 
 
        public void SetTable() 
        { 
            var query = 
            from c in dc.Categories select c; 
            CategoryList = query.ToList(); ; 
        } 
 
        public IList<Category> CategoryList 
        { 
            get
            set
        } 
 
        public Category SelectedItem 
        { 
            get
            set
        } 
 
    } 
 

using System.Collections.Generic; 
using NWOpenAccess; 
using Telerik.OpenAccess; 
using Telerik.OpenAccess.Query; 
 
namespace NWOA 
    public class TestViewModel 
    { 
        private IObjectScope scope = NWScopeProvider.GetNewObjectScope(); 
        public TestViewModel() 
        { 
            SetTable(); 
        } 
 
        public void SetTable() 
        { 
            var query = 
            from c in this.scope.Extent<Category>() select c; 
            CategoryList = query.ToList(); ; 
        } 
 
        public IList<Category> CategoryList 
        { 
            get
            set
        } 
 
        public Category SelectedItem 
        { 
            get
            set
        } 
 
    } 
 

I won't paste the code for the LINQ designer or the OA designer. Basically, just use the Categories table. From Northwind.

On the grid, moving up and down, the textboxes are updated in both apps.

The problem: If I edit in the grid, the changes are reflected in the textbox for the LINQ program and NOT the OA program.

What am I missing?


A follow up question... what is the best way to save the changes back to the database, and when? When the user moves off the record? When a button is pressed to confirm?












Nedyalko Nikolov
Telerik team
 answered on 13 Aug 2009
1 answer
160 views

Hi.

I'm using a trial version of RadControls for WPF.

I was looking for a way to dynamically "Zoom" in/out a 2D chart( both the x and y axises).

I tried to change TicksDistance value to achieve this goal, but no use.
I thought a refresh might be needed so I added a Dispatcher.Invoke call, and steel no use.

On the AxisY I tried all the above replacing TicksDistance of AxisX with Step property of AxisY.
No use.

If "zooming" is possible in a 2D (Spline series) what is the correct way achieving it?
Thank you
Uriya

code snippet:

 

this

 

 

.mMyChart.RadChart1.DefaultSeriesDefinition = new SplineSeriesDefinition();

 

List

 

<Data> listData = new List<Data>();
for
(int i = 0; i < oc.OctaveNotes.Length; i++)  

 

 

{    listData.Add(

new Data(oc.OctaveNotes[i]));    }

 

this

 

.mMyChart.RadChart1.ItemsSource = listData;

 

 

 

 

 

if

 

(e.Delta > 0)//wheel up  

 

 

 

 

    Int32 Step = this.mMyChart.RadChart1.DefaultView.ChartArea.AxisX.TicksDistance;  

    Step = Step / 4 * 5; 

 

    this.mMyChart.RadChart1.DefaultView.ChartArea.AxisX.TicksDistance = Step;  

 

else  

 

    Int32 Step = this.mMyChart.RadChart1.DefaultView.ChartArea.AxisX.TicksDistance; 

    Step = Step / 5 * 4; 

 

    this.mMyChart.RadChart1.DefaultView.ChartArea.AxisX.TicksDistance = Step;  

}


this
.mMyChart.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Render, mEmptyDelegate);

 

 

 

 

 

 

public class Data  

 

    private DateTime mX; 

 

    public DateTime X  

    { 

 

        get { return mX; } 
       set { mX = value; }  

 

    }

 

 

 

    private Double mY;
    public Double Y

 

    { 

 

 

        get { return mY; } 

 

        set { mY = value; } 

    }

    public

 

Data(NoteInOctave note)  

 

 

 

    {

        mX = note.NoteDateTime; 

 

        Double.TryParse(note.MesuredValue, out mY);  

    }

 

}

 

 

 

Vladimir Milev
Telerik team
 answered on 13 Aug 2009
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
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?