Telerik Forums
UI for WPF Forum
2 answers
127 views
According to this article, we can use different token in chartview to format our data.
I want to define a new token, for example a new token named such as #dateindays that
converts DateTime data to day number in current year. Is it possible to do so, and if yes, how?
Mohammad Amin Solhizadeh
Top achievements
Rank 1
 answered on 01 Aug 2012
2 answers
325 views
Hi there,

I'm using WPF and Telerik's WPF controls for the first time and I'm trying to figure out how I can change the style of the button. Right now I'm using radio buttons to switch between different sections of an application, but they still look like regular buttons. I want to remove the background and have an icon appear above the text in the middle instead.
It should also have a specific hover and active state.

Thanks,
Jacques
Jacques
Top achievements
Rank 2
 answered on 01 Aug 2012
8 answers
1.1K+ views
Hello,

I have been struggling with the GridView to get it to display my data as my ObservableCollection changes. It appears that the grid is only updating when the user moves a scroll bar. How can I make my grid update as my collection does, without messing up my scroll position. I attempted using the Rebind() method to get it to refresh, but the scroll bar resetting is unacceptable.

Here is a little information about my setup.

I am using the WPF Rad Controls Q2 2012 edition.

My Observable collection is a two dimensional collection that looks like this:

private ObservableCollection<ObservableCollection<LogField>> _RowData;
public ObservableCollection<ObservableCollection<LogField>> RowData
{
    get { return _RowData; }
    set
    {
        if (value != _RowData)
        {
            _RowData = value;
            onPropertyChanged(this, "RowData");
        }
    }
}

Here is what the LogField Class looks like:

public class LogField : INotifyPropertyChanged
    {
        private byte _HighlighFlag;
        public byte HighlightFlag
        {
            get { return _HighlighFlag; }
            set
            {
                if (value != _HighlighFlag)
                {
                    _HighlighFlag = value;
                    onPropertyChanged(this, "HighlightFlag");
                }
            }
        }
 
        private string _Value;
        public string Value
        {
            get { return _Value; }
            set
            {
                if (value != _Value)
                {
                    _Value = value;
                    onPropertyChanged(this, "Value");
                }
            }
        }
 
        private string _DisplayUnits;
        public string DisplayUnits
        {
            get { return _DisplayUnits; }
            set
            {
                if (value != _DisplayUnits)
                {
                    _DisplayUnits = value;
                    onPropertyChanged(this, "DisplayUnits");
                }
            }
        }
 
        private string _BaseUnits;
        public string BaseUnits
        {
            get { return _BaseUnits; }
            set
            {
                if (value != _BaseUnits)
                {
                    _BaseUnits = value;
                    onPropertyChanged(this, "BaseUnits");
                }
            }
        }
 
        private byte _FieldType;
        public byte FieldType
        {
            get { return _FieldType; }
            set
            {
                if (value != _FieldType)
                {
                    _FieldType = value;
                    onPropertyChanged(this, "FieldType");
                }
            }
        }
 
        private string _FieldFormat;
        public string FieldFormat
        {
            get { return _FieldFormat; }
            set
            {
                if (value != _FieldFormat)
                {
                    _FieldFormat = value;
                    onPropertyChanged(this, "FieldFormat");
                }
            }
        }
 
        private int _SelectOffset;
        public int SelectOffset
        {
            get { return _SelectOffset; }
            set
            {
                if (value != _SelectOffset)
                {
                    _SelectOffset = value;
                    onPropertyChanged(this, "SelectOffset");
                }
            }
        }
 
        private int _UnitNumber;
        public int UnitNumber
        {
            get { return _UnitNumber; }
            set
            {
                if (value != _UnitNumber)
                {
                    _UnitNumber = value;
                    onPropertyChanged(this, "UnitNumber");
                }
            }
        }
 
        public event PropertyChangedEventHandler PropertyChanged;
        private void onPropertyChanged(object sender, string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                PropertyChanged(sender, new PropertyChangedEventArgs(propertyName));
            }
        }
    }


I am setting up the columns manually and here is what the column setup and binding look like.

// Initialize the radGridView with the propper settings for a log screen.
int columnIndex = 0;
thisMMGridView.Height = 280;
LogScreen logScreen = (LogScreen)thisMMGridView.CurrentScreen;
thisMMGridView.radGridView.AutoGenerateColumns = false;
thisMMGridView.radGridView.Columns.Clear();
 
// Build the columns based on the headerStrings
foreach (string headerString in logScreen.ColumnHeaderStrings)
{
    GridViewDataColumn column = new GridViewDataColumn();
 
    // Create the column header
    TextBlock headerText = new TextBlock();
    headerText.Text = headerString;
    headerText.TextWrapping = TextWrapping.Wrap;
    headerText.TextAlignment = TextAlignment.Left;
    headerText.Padding = new Thickness(1, 0, 2, 0);
    column.HeaderCellStyle = thisMMGridView.TryFindResource("AlarmGridViewHeaderCellStyle") as Style;
    column.Header = headerText;
    column.UniqueName = headerString;
    thisMMGridView.radGridView.Columns.Add(column);
    // Bind the column to it's data
    column.DataMemberBinding = new Binding("["+ columnIndex.ToString() +"].Value");
     
    // Bump the column index that is used for the columnBind
    columnIndex++;
}
 
// Freeze the time & date columns so they are always visible
if (thisMMGridView.radGridView.Columns[1].UniqueName == "DATE")
{
    thisMMGridView.radGridView.FrozenColumnCount = 2;
}
else
{
    thisMMGridView.radGridView.FrozenColumnCount = 1;
}
 
// Set the ItemsSource property of the grid to the data collection.
thisMMGridView.radGridView.ItemsSource = thisMMGridView.Unit.LogData.RowData;


I have wasted a lot of time on this issue and I am just looking for a solution, so I can move forward. 

Hope to hear something soon,
Brian
Dimitrina
Telerik team
 answered on 01 Aug 2012
1 answer
182 views
Hi,

I am trying to use QueryableDataServiceCollectionView in my Prism based application.My view model is working fine when binding to DataServiceCollection or DataServiceQuery ,but now I want to gain more control over paging,filtering,sorting,and saving data,so I switched to QueryableDataServiceCollectionView.I changed my view model binding property "DataItems" from DataServiceCollection<T> to  QueryableDataServiceCollectionView<T> and now I see the whole data records returned though the pagesize on my QueryableDataServiceCollectionView and on my DataPager is 20.

The grid display 41 records in page 1 and 3 paging buttons [1 2 3].The paging becomes normal (20 records per page) once I click on page1, page 2, or page 3.I checked fiddler and found that the data service query for the first loading lacks the '$top=20' parameter

view.ViewModel.DataItem = new Telerik.Windows.Data.QueryableDataServiceCollectionView<User>(db, db.Users){  AutoLoad = true,PageSize=20};


<telerik:RadGridView    ItemsSource="{Binding PagedSource, ElementName=DataPager1}"  >

<telerik:RadDataPager  Name="DataPager1" Source="{Binding DataItem}"   PageSize="20" DisplayMode="Numeric">


Environment:
VS 2010
.NET 4 + WCF
EF 4
Telerik WPF  2012_2_0725 Trial Version


Thanks in advance
DMC Helpdesk
Top achievements
Rank 1
 answered on 31 Jul 2012
1 answer
126 views
I've tried to do this with Expression Blend and I've had no luck.

I have a form in my WPF application which contains a RadGridView.  I've defined Group Aggregates for the grid:

<telerik:RadGridView AlternationCount="1"
                     AutoExpandGroups="False"
                     AutoGenerateColumns="False"
                     CanUserDeleteRows="False"
                     CanUserFreezeColumns="False"
                     CanUserInsertRows="False"
                     CanUserResizeColumns="True"
                     CanUserSortColumns="True"
                     DataLoadMode="Synchronous"
                     EnableColumnVirtualization="True"
                     EnableRowVirtualization="True"
                     FontSize="16"
                     FontWeight="Bold"
                     Grid.Column="0"
                     Grid.Row="0"
                     IsReadOnly="True"
                     Name="HotListGrid"
                     ScrollViewer.CanContentScroll="True"
                     ScrollViewer.HorizontalScrollBarVisibility="Auto"
                     ScrollViewer.VerticalScrollBarVisibility="Auto"
                     SelectionChanged="HotListGrid_SelectionChanged"
                     SelectionUnit="FullRow"
                     ShowColumnFooters="True"
                     ShowGroupPanel="False"
                     ToolTip="Hot Lists">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn  DataMemberBinding="{Binding Name      , Mode=OneWay}"
                                     Header="Hot List"
                                     Width="323">
            <telerik:GridViewDataColumn.AggregateFunctions>
                <telerik:CountFunction Caption="Count: " ResultFormatString="{}{0:n0}" />
            </telerik:GridViewDataColumn.AggregateFunctions>
        </telerik:GridViewDataColumn>
        <telerik:GridViewDataColumn  DataMemberBinding="{Binding ListType  , Mode=OneWay}"
                                     Header="List Type"
                                     Width="Auto" />
        <telerik:GridViewDataColumn  DataMemberBinding="{Binding LastUpdate, Mode=OneWay, Converter={StaticResource DateConverter}}"
                                     Header="Last Update"
                                     Width="200" />
        <telerik:GridViewImageColumn DataMemberBinding="{Binding Status    , Mode=OneWay, Converter={StaticResource DeviceStatuses}}"
                                     Header="Status"
                                     ImageStretch="None"
                                     Width="95" />
        <telerik:GridViewDataColumn  Header="Entries"
                                     TextAlignment="Right"
                                     Width="135">
            <telerik:GridViewDataColumn.DataMemberBinding>
                <Binding Path="EntryCount"
                         Mode="OneWay"
                         Converter="{StaticResource LongConverter}"
                         ConverterParameter="#,##0" />
            </telerik:GridViewDataColumn.DataMemberBinding>
            <telerik:GridViewDataColumn.AggregateFunctions>
                <telerik:SumFunction ResultFormatString="{}{0:n0}" />
            </telerik:GridViewDataColumn.AggregateFunctions>
        </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

My application runs in police cars and has a "night mode" which changes the color pallette.  The problem is that the gradient brush used to draw the background of the Group Footer Row is not going away, so I have a light foreground color on a light background color in night mode that is difficult to read.

I have tried to edit the template for the GridViewGroupFooterRowStyle element in Expression Blend with no luck.  The gradient used in the background is not going away, even with this xaml in the app.xaml:

<Style TargetType="{x:Type telerik:GridViewGroupFooterRow}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type telerik:GridViewGroupFooterRow}">
                <Border x:Name="PART_GroupFooterRowBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                    <telerik:SelectiveScrollingGrid>
                        <telerik:SelectiveScrollingGrid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </telerik:SelectiveScrollingGrid.ColumnDefinitions>
                        <Border x:Name="PART_IndicatorPresenter" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,1,0" Grid.Column="0" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{TemplateBinding RowIndicatorVisibility}" VerticalAlignment="Stretch" Width="25">
                            <Border BorderBrush="White" BorderThickness="1" Background="#FFE4E4E4"/>
                        </Border>
                        <Border x:Name="PART_HierarchyIndent" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,0,1,0" Grid.Column="2" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Width="25">
                            <Border.Visibility>
                                <Binding Path="HasHierarchy" RelativeSource="{RelativeSource TemplatedParent}">
                                    <Binding.Converter>
                                        <telerik:BooleanToVisibilityConverter/>
                                    </Binding.Converter>
                                </Binding>
                            </Border.Visibility>
                        </Border>
                        <telerik:DataCellsPresenter x:Name="PART_DataCellsPresenter" Grid.Column="3" IsTabStop="False" />
                        <telerik:IndentPresenter x:Name="PART_IndentPresenter" Grid.Column="1" IsTabStop="False" IndentLevel="{TemplateBinding IndentLevel}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical">
                            <telerik:IndentPresenter.ItemTemplate>
                                <DataTemplate>
                                    <telerik:GridViewGroupFooterIndentCell IsTabStop="False">
                                        <telerik:StyleManager.Theme>
                                            <telerik:Office_BlackTheme/>
                                        </telerik:StyleManager.Theme>
                                    </telerik:GridViewGroupFooterIndentCell>
                                </DataTemplate>
                            </telerik:IndentPresenter.ItemTemplate>
                            <telerik:StyleManager.Theme>
                                <telerik:Office_BlackTheme/>
                            </telerik:StyleManager.Theme>
                        </telerik:IndentPresenter>
                    </telerik:SelectiveScrollingGrid>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="Background" Value="{DynamicResource DataHeaderBackground}"/>
    <Setter Property="BorderBrush" Value="{DynamicResource DataBorder}"/>
    <Setter Property="MinHeight" Value="25"/>
    <Setter Property="BorderThickness" Value="0,0,0,1"/>
    <Setter Property="VerticalContentAlignment" Value="Stretch"/>
    <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="Foreground" Value="{DynamicResource DataHeaderForeground}"/>
</Style>

How do I get rid of that gradient?
Tony
Top achievements
Rank 1
 answered on 31 Jul 2012
4 answers
655 views
I'm using a RadContextMenu on a Canvas.  When I select an item from the menu, I need to know the point in the Canvas in which I was when I opened the menu for placement of another control.  How do I get the top left position of the context menu?

Thanks for your help.
Joel Palmer
Top achievements
Rank 2
 answered on 31 Jul 2012
0 answers
146 views
Hi,

I have an structure like this:

MAinProject with a Custom WindowsClass and a Custom User control

From the main form called "Main" class is instantiated "WindowsClass". This class through a method call generates a window Radwindow type whose content is a custom user control.

Then from the main form made ​​the call to WindowsClass class method as follows:

myClassWindow.AddObjectWindow (objectName, Me)

This command fails me with the implicit object from VB.NET (Me)

The definition of the above method is as follows:

Public Sub AddObjectWindow (ByVal objectName As String, ByVal Owner As System.Windows.Controls.ContentControl)

Error 1 Value of type 'myProject.Main' can not be converted to 'System.Windows.Controls.ContentControl'. C: \ .... \ Projects \ MyProject \ MyProject \ Main.xaml.vb 100 57 myProject

1 - Why is this?
2 - how I can afford it, so the main form (Me) can be passed by value "ByVal" method and this in turn assigned to the Owner property of Radwindow.

I hope I have explained the issue as best as possible ....
Romell
Top achievements
Rank 1
 asked on 31 Jul 2012
2 answers
113 views
The title says it all; in Office products, the default is always selected when the Backstage is opened.
Thanks,
Steve
Steve
Top achievements
Rank 1
 answered on 31 Jul 2012
1 answer
129 views
I have a large dataset that scrolls horizontally.  When I scroll to the right, the aggregates in my group header scroll out of view.  Is there any way to keep this from happening?  I would like to keep the aggregates in the group header visible at all times.

Thank you.
Dimitrina
Telerik team
 answered on 31 Jul 2012
3 answers
342 views
Hi,

is it possible to count the Groups in a GridView and also get the Group Header?

Thanks
Best Regards
Rene
Dimitrina
Telerik team
 answered on 31 Jul 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
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?