Telerik Forums
UI for WPF Forum
0 answers
363 views

I have a enum type, and want to display it in column with image, and filter it with description. I directly convert enum type to image path, and can display it in column, but can not filter it. I convert enum type to a class with properties, such as image path, description, but can not binding it correctly.

<Window x:Class="TrafficLight.MainWindow"
        xmlns:local="clr-namespace:TrafficLight" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="600">
 
    <Window.Resources>
        <local:LightConvert x:Key="Converter"/>
        <local:LightStringConvert x:Key="StringConverter"/>
        <local:LightWrpper x:Key="LightWrpper"/>
 
        <DataTemplate x:Key="ImageCellTemplate">
            <Image Height="16" Width="16" HorizontalAlignment="Center" Source="{Binding SouthNorthLight, Converter={StaticResource ResourceKey=Converter}}"/>
        </DataTemplate>
 
        <DataTemplate x:Key="LightListTemplate">
            <StackPanel Orientation="Horizontal">
                <Image HorizontalAlignment="Center" VerticalAlignment="Center" Height="16" Width="16" Source="{Binding ImagePath}"/>
                <TextBlock Text="{Binding Description}" HorizontalAlignment="Left" VerticalAlignment="Center" Padding="5,0,2,0" />
            </StackPanel>
        </DataTemplate>
         
    </Window.Resources>
 
    <Window.DataContext>
        <local:LightViewModel/>
    </Window.DataContext>
    <Grid>
 
        <telerik:RadGridView AutoGenerateColumns="False" ItemsSource="{Binding LightCollection}">
            <telerik:RadGridView.Columns>
                 
                <telerik:GridViewDataColumn Header="Location"
                                            IsReadOnly="True"
                                            DataMemberBinding="{Binding Location}"/>
 
                <telerik:GridViewImageColumn Header="South North Light"
                                             IsReadOnly="True"
                                             ImageHeight="16"
                                             ImageWidth="16"
                                             ImageStretch="Uniform"
                                             IsFilterable="False"
                                             DataMemberBinding="{Binding SouthNorthLight, Converter={StaticResource StringConverter}}"/>
 
                <telerik:GridViewComboBoxColumn Header="South North Light"
                                                IsFilterable="False"
                                                FilterMemberPath="Description"
                                                DataMemberBinding="{Binding SouthNorthLight, Converter={StaticResource Converter}}"
                                                ItemsSource="{Binding Path=LightWrpperList, Source={StaticResource LightWrpper}}"
                                                ItemTemplate="{StaticResource LightListTemplate}"/>
 
                <telerik:GridViewImageColumn Header="East West Light"
                                             IsReadOnly="True"
                                             ImageHeight="24"
                                             ImageWidth="24"
                                             ImageStretch="Uniform"
                                             FilterMemberPath="Description"
                                             SortMemberPath="Description"
                                             DataMemberBinding="{Binding EastWestLight, Converter={StaticResource Converter}}">
                    <telerik:GridViewImageColumn.CellTemplate>
                        <DataTemplate>
                            <Image HorizontalAlignment="Center" Source="{Binding Path=ImagePath}"/>
                        </DataTemplate>
                    </telerik:GridViewImageColumn.CellTemplate>
                </telerik:GridViewImageColumn>
 
                <telerik:GridViewComboBoxColumn Header="South North Light"
                                                IsFilterable="True"
                                                FilterMemberPath="Description"
                                                DataMemberBinding="{Binding SouthNorthLight, Converter={StaticResource Converter}}"
                                                CellTemplate="{StaticResource ImageCellTemplate}"
                                                ItemsSource="{Binding Path=LightWrpperList, Source={StaticResource LightWrpper}}"
                                                ItemTemplate="{StaticResource LightListTemplate}"/>
                 
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
 
    </Grid>
</Window>
 
 
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Windows.Data;
 
namespace TrafficLight
{
    public enum Light
    {
        Green,
        Red,
        Yello,
    }
 
    public class Lights
    {
        public Light SouthNorthLight { get; set; }
 
        public Light EastWestLight { get; set; }
 
        public string Location { get; set; }
    }
 
    public class LightViewModel
    {
        public ObservableCollection<Lights> LightCollection { get; private set; }
 
        public LightViewModel()
        {
            LightCollection = new ObservableCollection<Lights>();
 
            LightCollection.Add(new Lights() { SouthNorthLight = Light.Green, EastWestLight = Light.Red, Location = "The 5th St" });
            LightCollection.Add(new Lights() { SouthNorthLight = Light.Red, EastWestLight = Light.Green, Location = "St John Rd" });
            LightCollection.Add(new Lights() { SouthNorthLight = Light.Yello, EastWestLight = Light.Red, Location = "Sents Rd" });
        }
    }
 
    public class LightWrpper
    {
 
        public static List<LightWrpper> LightWrpperList { get; private set; }
 
        public static LightWrpper Red { get; private set; }
        public static LightWrpper Green { get; private set; }
        public static LightWrpper Yello { get; private set; }
 
        static LightWrpper()
        {
            Red = new LightWrpper() { Light = Light.Red, ImagePath = "Images/Red.png", Description = "Red Light On" };
            Green = new LightWrpper() { Light = Light.Green, ImagePath = "Images/Green.png", Description = "Green Light On" };
            Yello = new LightWrpper() { Light = Light.Yello, ImagePath = "Images/Yello.png", Description = "Yello Light On" };
 
            LightWrpperList = new List<LightWrpper>();
            LightWrpperList.Add(Red);
            LightWrpperList.Add(Green);
            LightWrpperList.Add(Yello);
        }
 
        public Light Light { get; private set; }
        public string ImagePath { get; private set; }
        public string Description { get; private set; }
    }
 
    [ValueConversion(typeof(Light), typeof(LightWrpper))]
    public class LightConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return LightWrpper.Yello;
            }
 
            var light = (Light)value;
            switch (light)
            {
                case Light.Green:
                    return LightWrpper.Green;
                case Light.Red:
                    return LightWrpper.Red;
                default:
                    return LightWrpper.Yello;
            }
        }
 
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return Light.Yello;
            }
 
            var light = (LightWrpper)value;
            switch (light.Light)
            {
                case Light.Green:
                    return Light.Green;
                case Light.Red:
                    return Light.Red;
                default:
                    return Light.Yello;
            }
        }
    }
 
    [ValueConversion(typeof(Light), typeof(string))]
    public class LightStringConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var light = (Light)value;
            switch (light)
            {
                case Light.Green:
                    return "Images/Green.png";
                case Light.Red:
                    return "Images/Red.png";
                default:
                    return "Images/Yello.png";
            }
        }
 
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
 
}






Yu
Top achievements
Rank 1
 asked on 07 Oct 2013
6 answers
163 views
Hi I have notebook with touch sreen (win 8) and when I touch and move with my finger above RadTreeViewItem (or RadTreeView) my application crash. I do not have implemented DragAndDrop.
Jiri
Top achievements
Rank 1
 answered on 07 Oct 2013
5 answers
148 views
Hi
I created a pivotgrid and this my localdatasourceprovider.
How can I change the row order? For example by another field "Sequential"..
Now it orders by "CategoryDescription"
Thanks

 <pivot:LocalDataSourceProvider x:Key="LocalDataProvider" >
            <pivot:LocalDataSourceProvider.RowGroupDescriptions>                 <pivot:PropertyGroupDescription PropertyName="CategoryDescription" CustomName="CategoryDescription" />                             </pivot:LocalDataSourceProvider.RowGroupDescriptions>             <pivot:LocalDataSourceProvider.ColumnGroupDescriptions>                 <pivot:PropertyGroupDescription PropertyName="BreakdownStepContextCode"></pivot:PropertyGroupDescription>                             </pivot:LocalDataSourceProvider.ColumnGroupDescriptions>             <pivot:LocalDataSourceProvider.AggregateDescriptions>                 <pivot:PropertyAggregateDescription PropertyName="CompletedStepsCount" CustomName="P" />             </pivot:LocalDataSourceProvider.AggregateDescriptions>         </pivot:LocalDataSourceProvider>

Rosen Vladimirov
Telerik team
 answered on 07 Oct 2013
11 answers
866 views
Greetings,

I have recently upgraded to the newest RAD Controls for WPF and discovered problem with Drag & Drop. It is not working after upgrade.
I have made small project to verify that problem is not in our code and when I use dlls of version "2012.3.1129.40" it is working without problem. When I use dlls of version 2013.2.0611.40 it is not working. Could you help me out?

In attachement I sent a small WPF project.  You can see that in xaml I aneble dragging on each item in RadTreeView and in the code you can see that I add handlers for Drag & Drop operations. When drop occurs I add info about it to the listbox. For old dlls it works but for new ones it does not.

Xaml:
<Window x:Class="TelerikWpfApplication.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">
<Grid>
<telerik:RadTreeView Height="250" HorizontalAlignment="Left" Margin="10,10,0,0" Name="radTreeView1" VerticalAlignment="Top" Width="150">
<telerik:RadTreeView.Resources>
<Style TargetType="{x:Type telerik:RadTreeViewItem}">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="telerik:DragDropManager.AllowDrag" Value="True"></Setter>
</Style>
</telerik:RadTreeView.Resources>
<telerik:RadTreeViewItem DropPosition="Inside" Header="Item 1" />
<telerik:RadTreeViewItem DropPosition="Inside" Header="Item 2" />
<telerik:RadTreeViewItem DropPosition="Inside" Header="Item 3" />
<telerik:RadTreeViewItem DropPosition="Inside" Header="Item 4" />
<telerik:RadTreeViewItem DropPosition="Inside" Header="Item 5" />
</telerik:RadTreeView>
<ListBox Height="287" HorizontalAlignment="Left" Margin="166,12,0,0" Name="listBox1" VerticalAlignment="Top" Width="134" />
</Grid>
</Window>


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;

using Telerik.Windows.Controls;
using Telerik.Windows.DragDrop;

namespace TelerikWpfApplication
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();

DragDropManager.AddDragInitializeHandler(radTreeView1, OnDragInitialize, true);
DragDropManager.AddDragEnterHandler(radTreeView1, OnDragEnter, true);
DragDropManager.AddDropHandler(radTreeView1, OnDrop, true);
}

private void OnDragInitialize(object sender, DragInitializeEventArgs e)
{
// get zone
RadTreeViewItem item = e.OriginalSource as RadTreeViewItem;
object data = item.Item;

e.AllowedEffects = DragDropEffects.Move;
}

private void OnDragEnter(object sender, Telerik.Windows.DragDrop.DragEventArgs args)
{

}

private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs args)
{
listBox1.Items.Add("Dropped to: " + args.Source.ToString());
}
}
}
Dušan
Top achievements
Rank 1
 answered on 07 Oct 2013
4 answers
358 views
Hi,

I am trying to use dynamic BackstageItems. But how can i define a correct DataTemplate where all Bindings work?

Her my code...
<telerik:RadRibbonWindow 
    x:Class="WpfRibbonBackstage.MainWindow"
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonView"
    Title="MainWindow" Height="350" Width="525">
    <Grid>
 
        <Grid.Resources>
 
            <DataTemplate x:Key="BackstageSmallButtonTemplate">
 
                <telerik:RadRibbonBackstageItem Header="{Binding Text}"
                                                IsDefault="{Binding IsDefault}"
                                                IsSelectable="{Binding IsSelectable}"
                                                IsGroupSeparator="{Binding IsGroupSeparator}"
                                                CloseOnClick="{Binding CloseOnClick}"/>
 
            </DataTemplate>
 
        </Grid.Resources>
 
        <telerik:RadRibbonView   x:Name="Ribbon"
                                Title="Test"
                                ApplicationButtonContent="FILE"
                                ApplicationButtonVisibility="Visible"
                                 >
             
            <telerik:RadRibbonTab Header="Home"></telerik:RadRibbonTab>
 
            <telerik:RadRibbonView.Backstage>
 
                <telerik:RadRibbonBackstage ItemsSource="{Binding BackstageItems}"
                                            ItemTemplate="{StaticResource BackstageSmallButtonTemplate}"
                                            SelectedItem="{Binding SelectedBackstageItem}">
 
                </telerik:RadRibbonBackstage>
 
            </telerik:RadRibbonView.Backstage>
 
        </telerik:RadRibbonView>
 
 
    </Grid>
</telerik:RadRibbonWindow>

The Header binding works, but all other not!
Waht is wrong?


Thomas
Top achievements
Rank 1
 answered on 07 Oct 2013
1 answer
161 views
I've recently undertaken a project using an older version of RadControls and I'm really struggling in my attempt to customize the 3d pie chart. For reference, the developer machine has the Q1 2011 RadControls for WPF installed on it.

What I'm trying to do is style the item labels in some way that they don't overlap, or barring that, add some customized tooltips that display the label data. I've done a ton of research and playing around with custom styles, but:

A: 3d Pie labels/tooltips on this version appear to be Un-stylable or
B: I'm way off on attempts to restyle.

The latter seems unlikely since I was able to restyle the labels on a 2d pie chart using the same static resource, but I haven't found any documentation explicitly stating that the labels in this chart are not able to be styled.

Is there any older documentation available that could help me figure this out?

Also, I'm using MVVM format so code behind solutions are not very practical.
Evgenia
Telerik team
 answered on 07 Oct 2013
4 answers
182 views
I'v setup applied a new custom style to a RadAutoCompleteBox in order to change its visual design. I would also like to customize its RadAutoCompleteBoxItems (e.g. change the Background and foreground , Border etc). How can this be achieved?  But if I'm searching for some items, no entries are shown in the drop down.

Please download the source file from the following url : www.sharangrafix.in/openautofocus/OpenOnFocusAutoComplete.zip

Thanks,
Sharan
Saravanan
Top achievements
Rank 1
 answered on 06 Oct 2013
4 answers
222 views
When Item is selected from dropdown then there is a cursor in a textblock which always stay there and Also the selected Item gets the border and a close button. I want simple text instead of the border and close button. can anyone help?
Hrishi
Top achievements
Rank 1
 answered on 05 Oct 2013
2 answers
125 views
I have several ComboBox's that display items in a meaningful was to my users, but actually reflect something else. For example, the ComboBox might display car part descriptions, but for processing I need to know the actual part number that the part description was derived from. Is there anyway to associate the part number with the items being displayed in the ComboBox?
Stephen
Top achievements
Rank 1
Iron
 answered on 04 Oct 2013
1 answer
165 views
Hi.
https://dl.dropboxusercontent.com/u/87574708/%D0%91%D0%B5%D0%B7%D1%8B%D0%BC%D1%8F%D0%BD%D0%BD%D1%8B%D0%B9.png

In photoshop menu MenuItem parent has toggleButton style, and hi is like selector from children MenuItem .

<telerik:RadMenu  Orientation="Vertical"  telerik:StyleManager.Theme="Windows8Touch" ClickToOpen="True" >          
          <telerik:RadMenuItem Header="{Binding Path=SelectorType,Mode=TwoWay}" cal:Message.Attach="[Event Click] = [Action SetOperation($source )]" >
              <telerik:RadMenuItem Header="1" cal:Message.Attach="[Event Click] = [Action SetOperationSelect($source )]" />
              <telerik:RadMenuItem Header="2" cal:Message.Attach="[Event Click] = [Action SetOperationSelectRing($source )]" />
              <telerik:RadMenuItem Header="3" cal:Message.Attach="[Event Click] = [Action SetOperationSelectRadius($source )]" />
          </telerik:RadMenuItem >
</telerik:RadMenu>

Why Event Click on root firing  before click on child elements.
Has any methods to supperes opening child elements? I want to open him on mouse touchdown on 2 sec.

Kalin
Telerik team
 answered on 04 Oct 2013
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
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?