Telerik Forums
UI for WPF Forum
2 answers
279 views
Hi team,

I have following codes
<telerik:RadGridView x:Name="HistoryData" GroupRenderMode="Flat"
                             GridLinesVisibility="Vertical"
                             ColumnWidth="50"
                             CanUserFreezeColumns="False"
                             AutoGenerateColumns="False"
                             AutoExpandGroups="True"
                             IsFilteringAllowed="True"
                             ShowGroupPanel="False"
                             RowIndicatorVisibility="Collapsed"
                             d:DataContext="{d:DesignData Source=../SampleData/SampleData.xaml}"
                             >

The sample data and the corresponding types are all ready. 
But I see no data in the design time window of grid view. 
Anything I am missing?
Jackey
Top achievements
Rank 1
 answered on 24 Dec 2014
3 answers
445 views
Hi,

I have a problem when setting my DisplayMemberPath:

<t:RadAutoCompleteBox x:Name="AutoCompleteBox" Grid.Row="2" Grid.ColumnSpan="3"
                                         ItemsSource="{Binding Suggests}"
                                        SearchText="{Binding TextSearch, Mode=TwoWay}"
                                        SelectedItem="{Binding SelectedSuggest, Mode=TwoWay}"
                                    TextSearchPath="SearchPath" DisplayMemberPath="Name">
                <t:RadAutoCompleteBox.DropDownItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Name}" />
                            <TextBlock Text=" - " />
                            <TextBlock Text="{Binding Code}" />
                        </StackPanel>
                    </DataTemplate>
                </t:RadAutoCompleteBox.DropDownItemTemplate>
            </t:RadAutoCompleteBox>


In the code above, all is working fine, except that when i have selected an item, the text displayed is the one in my SearchPath property, and not the one in my Name property.
What did i do wrong?
Polya
Telerik team
 answered on 23 Dec 2014
4 answers
485 views
I have a radgrid with sometimes 1000+ items, I want to be able to add new items like http://docs.telerik.com/devtools/wpf/controls/radgridview/managing-data/images/RadGridView_AddingNewItems_1.png but if possible, I would like "new" row to always be visible even though I am scrolling up and down

Also I am not writing anything in my codebehind so if possible it should be pure xaml/commands

Also not sure why CanUserInsertRows="True" do not show anything in the UI

<radBusyIndicator:DmsRadBusyIndicator
    IsBusy="{Binding Path=WaterBucketIsBusy}"
    BusyContent="{Binding Path=WaterBucketIsBusyMessage}"
    Grid.Column="0"
    Grid.Row="0"
    Margin="9">
    <telerik:RadGridView
        AutoGenerateColumns="False"
        CanUserInsertRows="True"
        
        ItemsSource="{Binding Path=WaterBuckets}">
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn
                DataMemberBinding="{Binding Path=Id}"
                IsReadOnly="True"
                Header="{x:Static localization:WaterBucketTexts.Bucket}">
                <telerik:GridViewDataColumn.CellTemplate>
                    <DataTemplate DataType="dom:PBucketModel">
                        <TextBlock
                            Text="{Binding Path=Id}" />
                    </DataTemplate>
                </telerik:GridViewDataColumn.CellTemplate>
            </telerik:GridViewDataColumn>
            <telerik:GridViewDataColumn
                DataMemberBinding="{Binding Path=BullId}"
                IsReadOnly="True"
                Header="{x:Static localization:WaterBucketTexts.BullId}">
                <telerik:GridViewDataColumn.CellTemplate>
                    <DataTemplate DataType="dom:PBucketModel">
                        <TextBlock
                            Text="{Binding Path=BullId}" />
                    </DataTemplate>
                </telerik:GridViewDataColumn.CellTemplate>
            </telerik:GridViewDataColumn>
            <telerik:GridViewDataColumn
                DataMemberBinding="{Binding Path=WaterType}"
                IsReadOnly="True"
                Header="{x:Static localization:WaterBucketTexts.WaterType}">
                <telerik:GridViewDataColumn.CellTemplate>
                    <DataTemplate DataType="dom:PBucketModel">
                        <TextBlock
                            Text="{Binding Path=WaterType.WaterName}" />
                    </DataTemplate>
                </telerik:GridViewDataColumn.CellTemplate>
            </telerik:GridViewDataColumn>
            <telerik:GridViewDataColumn
                DataMemberBinding="{Binding Path=Spent}"
                IsReadOnly="True"
                Header="{x:Static localization:WaterBucketTexts.Spent}">
                <telerik:GridViewDataColumn.CellTemplate>
                    <DataTemplate DataType="dom:PBucketModel">
                        <TextBlock
                            Text="{Binding Path=Spent}" />
                    </DataTemplate>
                </telerik:GridViewDataColumn.CellTemplate>
            </telerik:GridViewDataColumn>
            <telerik:GridViewDataColumn
                DataMemberBinding="{Binding Path=Delivered}"
                IsReadOnly="True"
                Header="{x:Static localization:WaterBucketTexts.Delivered}">
                <telerik:GridViewDataColumn.CellTemplate>
                    <DataTemplate DataType="dom:PBucketModel">
                        <TextBlock
                            Text="{Binding Path=Delivered}" />
                    </DataTemplate>
                </telerik:GridViewDataColumn.CellTemplate>
            </telerik:GridViewDataColumn>
        </telerik:RadGridView.Columns>
    </telerik:RadGridView>
Dimitrina
Telerik team
 answered on 23 Dec 2014
1 answer
484 views
Hi,

i use a RadGridView and your "Header Context Menu" Example, where you can show or hide Columns. I have 10 Columns, 5 of them are
"IsVisible = False". On right click of GridViewHeader i can choose the other 5 columns. This works fine.

public class GridViewHeaderMenu
    {
        private readonly RadGridView grid = null;
 
        public GridViewHeaderMenu(RadGridView grid)
        {
            this.grid = grid;
        }
 
        public static readonly DependencyProperty IsEnabledProperty
           = DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(GridViewHeaderMenu),
               new PropertyMetadata(new PropertyChangedCallback(OnIsEnabledPropertyChanged)));
 
        public static void SetIsEnabled(DependencyObject dependencyObject, bool enabled)
        {
            dependencyObject.SetValue(IsEnabledProperty, enabled);
        }
 
        public static bool GetIsEnabled(DependencyObject dependencyObject)
        {
            return (bool)dependencyObject.GetValue(IsEnabledProperty);
        }
 
        private static void OnIsEnabledPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            RadGridView grid = dependencyObject as RadGridView;
            if (grid != null)
            {
                if ((bool)e.NewValue)
                {
                    // Create new GridViewHeaderMenu and attach RowLoaded event.
                    GridViewHeaderMenu menu = new GridViewHeaderMenu(grid);
                    menu.Attach();
                }
            }
        }
 
        private void Attach()
        {
            if (grid != null)
            {
                // create menu
                RadContextMenu contextMenu = new RadContextMenu();
                // set menu Theme
                StyleManager.SetTheme(contextMenu, StyleManager.GetTheme(grid));
 
                contextMenu.Opened += OnMenuOpened;
                contextMenu.ItemClick += OnMenuItemClick;
 
                RadContextMenu.SetContextMenu(grid, contextMenu);
            }
        }
 
        void OnMenuOpened(object sender, RoutedEventArgs e)
        {
            RadContextMenu menu = (RadContextMenu)sender;
            GridViewHeaderCell cell = menu.GetClickedElement<GridViewHeaderCell>();
 
            if (cell != null)
            {
                menu.Items.Clear();
 
                RadMenuItem item = new RadMenuItem();
                item.Header = String.Format(@Klassen.Language.GetTextbyCode("SortAufsteigend") + cell.Column.Header);
                menu.Items.Add(item);
 
                item = new RadMenuItem();
                item.Header = String.Format(@Klassen.Language.GetTextbyCode("SortAbsteigend") + cell.Column.Header);
                menu.Items.Add(item);
 
                item = new RadMenuItem();
                item.Header = String.Format(@Klassen.Language.GetTextbyCode("SortClear") + cell.Column.Header);
                menu.Items.Add(item);
                 
                item = new RadMenuItem();
                item.Header = Klassen.Language.GetTextbyCode("ChooseColumns");
                menu.Items.Add(item);
 
                // create menu items
                foreach (GridViewColumn column in grid.Columns)
                {
                    RadMenuItem subMenu = new RadMenuItem();
                    subMenu.Header = column.Header;
                    subMenu.IsCheckable = true;
                    subMenu.IsChecked = true;
 
                    Binding isCheckedBinding = new Binding("IsVisible");
                    isCheckedBinding.Mode = BindingMode.TwoWay;
                    isCheckedBinding.Source = column;
 
                    // bind IsChecked menu item property to IsVisible column property
                    subMenu.SetBinding(RadMenuItem.IsCheckedProperty, isCheckedBinding);
 
                    item.Items.Add(subMenu);
                }
            }
            else
            {
                menu.IsOpen = false;
            }
        }
 
        void OnMenuItemClick(object sender, RoutedEventArgs e)
        {
            RadContextMenu menu = (RadContextMenu)sender;
 
            GridViewHeaderCell cell = menu.GetClickedElement<GridViewHeaderCell>();
            RadMenuItem clickedItem = ((RadRoutedEventArgs)e).OriginalSource as RadMenuItem;
            GridViewColumn column = cell.Column;
             
            if (clickedItem.Parent is RadMenuItem)
                return;
 
            string header = Convert.ToString(clickedItem.Header);
 
            using (grid.DeferRefresh())
            {
                ColumnSortDescriptor sd = (from d in grid.SortDescriptors.OfType<ColumnSortDescriptor>()
                                           where object.Equals(d.Column, column)
                                           select d).FirstOrDefault();
 
                if (header.Contains("Sort Ascending"))
                {
                    if (sd != null)
                    {
                        grid.SortDescriptors.Remove(sd);
                    }
 
                    ColumnSortDescriptor newDescriptor = new ColumnSortDescriptor();
                    newDescriptor.Column = column;
                    newDescriptor.SortDirection = ListSortDirection.Ascending;
 
                    grid.SortDescriptors.Add(newDescriptor);
                }
                else if (header.Contains("Sort Descending"))
                {
                    if (sd != null)
                    {
                        grid.SortDescriptors.Remove(sd);
                    }
 
                    ColumnSortDescriptor newDescriptor = new ColumnSortDescriptor();
                    newDescriptor.Column = column;
                    newDescriptor.SortDirection = ListSortDirection.Descending;
 
                    grid.SortDescriptors.Add(newDescriptor);
                }
                else if (header.Contains("Clear Sorting"))
                {
                    if (sd != null)
                    {
                        grid.SortDescriptors.Remove(sd);
                    }
                }
            }
        }
    }

But how do i save the condition, which column is visible and which one not?

Thanks
Best Regards
Rene
Dimitrina
Telerik team
 answered on 23 Dec 2014
4 answers
129 views
I am using telerik uı for wpf in my application.I can run my application properly.But ı cant  see my pages in design mode. İnvalid markup error because of telerik features.

Best regards
Erhan
Top achievements
Rank 1
 answered on 23 Dec 2014
5 answers
240 views
Hello,
My company is attempting to implement an experience with the RadGridView that I'm struggling with. Currently on all of our grids we define a set of 'data' columns that are simple columns that display values; after the data columns we then define a column that contains several buttons (ex. edit, delete, etc.) that are only visible when the given row is selected. This experience is unacceptable since in scenarios where many 'data' columns exist the user has to scroll all the way to the right of the grid in order to see the 'action' column.

The desired experience is that when a row is selected the 'action' column appears at the right edge of the grid regardless of any scrolling that can take place on the 'data' column set.

I've been spinning my wheels for quite a while now and am out of ideas to make this work. The block I keep running in to is that the GridViewRow has no idea of the size of the ScrollViewer so it cannot place the column in the correct place on the screen, and the
GridViewScrollViewer has no idea what row is selected so it cannot place the buttons correctly. I might be able to make a seperate GridViewVirtualizingPanel to hold the 'action' column set but I don't think I would be to communicate which row is selected between the two Panels simply.

If a 'frozen' column could be placed at the right of the grid I think I could get the experience we want but that doesn't appear to be supported.

Is there a simple way to implement this experience that I haven't thought of? Thanks,Jason
Vanya Pavlova
Telerik team
 answered on 23 Dec 2014
3 answers
118 views
hi to everybody
i tried to use indicators to my project with get help demo telerik
i createing some class .for instance FinancialIndicatorSwitch  and FinancialSeriesTypeSwitch and etc
but when i start i get this error
Error    2    A 'Binding' cannot be used within a 'RadCartesianChart' collection. A 'Binding' can only be set on a DependencyProperty of a DependencyObject.    C:\Users\masoud\Documents\Visual Studio 2013\Projects\exercise_telerik\testchart\testchart\View\indacator.xaml    36    36    testchart

it say problem is in dependencyproperty that define in class and use in view
where this dp use in view in define here
<chart:RadCartesianChart x:Name="RadChart1" Palette="Windows8" Margin="20,0,8,0"
                                   example:FinancialIndicatorSwitch.MainIndicator="{Binding MainIndicator, Mode=TwoWay}"
                                   example:FinancialSeriesTypeSwitch.SeriesType="{Binding SeriesType}"
 
 
and
 
        <chart:RadCartesianChart x:Name="RadChart2" Palette="Windows8" Grid.Row="1" Margin="20,10,8,0"
                                   example:FinancialIndicatorSwitch.SecondaryIndicator="{Binding SecondaryIndicator, Mode=TwoWay}">

i tried to solution this  error but i was unsuccessful 
please help me
Petar Marchev
Telerik team
 answered on 23 Dec 2014
1 answer
274 views
I'm having difficulty displaying design-time data in a user control that makes heavy use of RadMap.
The method I use for design-time is similar to the Sophia Car Rental project. I set the data context in the UserControl tag as follows:

             xmlns:design="clr-namespace:XYZ.ViewModel.Design"
             d:DataContext="{d:DesignInstance d:Type=design:PlanViewModel, d:IsDesignTimeCreatable=True}"

I then create a class that inherits from my run-time view model, but is used to put some dummy data on the screen. Here I am adding an information layer and setting the background to blue so I can see it. Also note the compiler directives to keep this design-time stuff out of my release a..

#if DESIGNONLY
using System.Windows.Media;
using Telerik.Windows.Controls.Map;

namespace XYZ.ViewModel.Design
{
    public class PlanViewModel : PlanView.PlanViewModel
    {
        public override void SetControlState(bool resetToInitialState = false)
        {
            base.SetControlState(resetToInitialState);

            var layer = new InformationLayer
            {
                Background = Brushes.Blue
            };
            Layers.Add(layer);
        }
    }
}
#endif

Lastly, this happens in the SetControlState() method, which in this case is called in the base class when the map's InitializationCompleted method is called.
The Layers Collection is defined as such;

        public ObservableCollection<InformationLayer> Layers { get; private set; }

and the user control definition looks like this;

        <telerik:RadMap HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                        ZoomLevel="{Binding ZoomLevel, Mode=TwoWay}" Center="{Binding Center, Mode=TwoWay}"
                        UseDefaultLayout="False" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4"
                        x:Name="MapContainer" ItemsSource="{Binding Layers}">
            <!-- Send the mouse position to the view model so we can fake the mouse position control with our own data -->
            <telerik:EventToCommandBehavior.EventBindings>
                <telerik:EventBinding Command="{Binding MousePositionCommand}" EventName="MouseMove"
                                      PassEventArgsToCommand="True" RaiseOnHandledEvents="True"/>
            </telerik:EventToCommandBehavior.EventBindings>
            <!-- This provider gives us a blank slate that can handle UTM based data -->
            <telerik:RadMap.Providers>
                <telerik:EmptyProvider>
                    <telerik:EmptyProvider.Projection>
                        <telerik:EPSG900913Projection />
                    </telerik:EmptyProvider.Projection>
                </telerik:EmptyProvider>
            </telerik:RadMap.Providers>
        </telerik:RadMap>

If I create the InformationLayer in XAML, I see a blue map as expected. If I do it in code - nothing. This technique works perfectly with other controls, so I'm somewhat at a loss as to what is happening, especially since similar code at run time creates a map with an InformationLayer with a blue background.

Any suggestions are welcome.

Petar Mladenov
Telerik team
 answered on 23 Dec 2014
1 answer
244 views
Hi,

I use a treeview with LoadOnDemand enabled. When I expand a node it seems that the property IsExpanded switch from False to True (normal) + switch from True to False (i dont understand) and finally from False to True. We can imagine that final status is the goal, BUT when i expand an empty node the final switch (False to True) dont occurs (think its link with observablecollection)
I join a sample here post. If you open the Root node + open Item node and then try to open empty node SubItem you will see that SubItem IsExpanded property stay false.
What's the issue ?
Regards
Luc 
Petar Mladenov
Telerik team
 answered on 22 Dec 2014
2 answers
113 views
Hi all!
I'm using custom TiledMapSource, which takes tiles from the file system.
But I want to hide tiles from enduser and place them inside the resource pack of the application.

I tried to set tile files to build action "Resource" and giving URI like "pack://application:,,,/MyAssemble;component/tiles/z0/0/x0/0/y0.png"
But tiles doesn't appear on the map.

Is it possible to store and use tiles from application resources ?
Petar Mladenov
Telerik team
 answered on 19 Dec 2014
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
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?