Telerik Forums
UI for WPF Forum
2 answers
239 views

Hi,

I'm using RadGridView to display object's properties, like a PropertyGrid.

I need to change the template of the cell according to the type of the property.

I defined templates for text, color, and enum, also two template selectors, one for edit and one for normal mode.

For example, an enum should be edit  by choosing an item out of a combobox and to be displayed in a TextBlock.

The problem, is when I set the enum template for both the edit selector and normal selector, the combobox is not displayed in edit mode, like this template is ignored.

In resources: 

        <DataTemplate x:Key="TextPropertyValueEditTemplate">
            <TextBox Text="{Binding PropertyValue, Mode=TwoWay}" />
        </DataTemplate>
        
<
DataTemplate x:Key="ColorPropertyValueEditTemplate">
            <telerik:RadColorPicker SelectedColor="{Binding PropertyValue, Mode=TwoWay}" ColorButtonStyle="{StaticResource ColorButtonStyle}" />
        </DataTemplate>
        
<
DataTemplate x:Key="EnumPropertyValueEditTemplate">
            <ComboBox Text="{Binding PropertyValue, Mode=OneWay}"
                          SelectedValue="{Binding PropertyValue, Mode=TwoWay}" 
                          ItemsSource="{Binding EnumNames}"   />
        </DataTemplate>

        <DataTemplate x:Key="EnumPropertyValueNormalTemplate">
                        <TextBox Text="{Binding PropertyValue}" />
                </DataTemplate>


        <Controls:PropertyValueDataTemplateSelector x:Key="PropertyValueEditTemplateSelector"
                                                           TextTemplate="{StaticResource TextPropertyValueEditTemplate}" 
                                                           ColorTemplate="{StaticResource ColorPropertyValueEditTemplate}"
                                                           EnumTemplate="{StaticResource EnumPropertyValueEditTemplate}"
                                                          />
        <Controls:PropertyValueDataTemplateSelector x:Key="PropertyValueTemplateSelector"
                                                           ColorTemplate="{StaticResource ColorPropertyValueEditTemplate}"
                                                           EnumTemplate="{StaticResource TextPropertyValueEditTemplate}"
                                                           />


In the grid:

<telerik:RadGridView Name="dataGrid1"
                             AutoGenerateColumns="False" 
                             ShowGroupPanel="False"
                             ShowColumnHeaders="False"
                             >

            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn  Header="Name" Width="120" 
                                             DataMemberBinding="{Binding PropertyName}"/>
                <telerik:GridViewDataColumn  Header="Value" Width="100*"
                                             DataMemberBinding="{Binding PropertyValue}" 
                                             CellTemplateSelector="{StaticResource PropertyValueTemplateSelector}"
                                             CellEditTemplateSelector="{StaticResource PropertyValueEditTemplateSelector}" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

Now, I know one way to make this sample work, is just to remove the EnumTemplate
from propertyValueTemplateSelector (Normal), It will work, but I have other types I want to
display differently in edit and normal mode.

Appreciate for any help.

Shmulik
Top achievements
Rank 1
 answered on 03 Nov 2010
1 answer
203 views
Hello,
I'm using the RadPanelBar in an application who use the MVVM pattern with the following binding on the ItemSource property:

<telerikNavigation:RadPanelBar Grid.Row="1" Margin="10" telerik:StyleManager.Theme="Windows7" x:Name="pbPanels"
            ItemsSource="{Binding NavigationsPanelItems}"
            SelectedItem="{Binding SelectedPanelItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
DisplayMemberPath="DisplayName">
        </telerikNavigation:RadPanelBar>
<telerikNavigation:RadPanelBar Grid.Row="1" Margin="10" telerik:StyleManager.Theme="Windows7" x:Name="pbPanels"
            ItemsSource="{Binding NavigationsPanelItems}"
            SelectedItem="{Binding SelectedPanelItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
            DisplayMemberPath="DisplayName">
</telerikNavigation:RadPanelBar>

with a hierarchicaldatatemplate:

<HierarchicalDataTemplate DataType="{x:Type vm:TPNavigationGeneralInfoViewModel}"
                    ItemTemplate="{StaticResource pbiGeneralInfoTemplate}" ItemsSource="{Binding PanelBarContent}">
                <TextBlock Text="{Binding DisplayName}" Height="20" Margin="5 2 5 2" FontWeight="Bold" FontSize="16"/
</HierarchicalDataTemplate>

where the ItemTemplate is a custom UserControl.

I need to bind the property IsEnabled of each one of the PanelBarItems inside the collection, but I'm not able to do that. Can you please give me some hints?

Thanks,
Flavio
Miro Miroslavov
Telerik team
 answered on 03 Nov 2010
4 answers
286 views
Hi,

We are looking to export data from the grid that a user has filtered. Is there anyway of getting the rows that are visible after the user has filtered them?


Craig
Craig
Top achievements
Rank 1
 answered on 03 Nov 2010
2 answers
351 views
Hi..
I have the following RadButton.. how can I add CTRL+N to fire it too?  thanks

 

 

<telerikPresentation:RadButton BorderBrush="Blue" BorderThickness="1" ClickMode="Press" FontSize="20" Margin="162,0,0,9" Name="btnNew" Click="btnNew_Click" Height="40" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="90">

 

 

 

<telerikPresentation:RadButton.Effect>

 

 

 

<DropShadowEffect ShadowDepth="5" />

 

 

 

</telerikPresentation:RadButton.Effect>

 

 

 

<StackPanel Height="28" HorizontalAlignment="Left" Orientation="Horizontal" VerticalAlignment="Top" Width="81" >

 

 

 

<Image Height="28" Source="/icons/truck_blue.png" Width="30" />

 

 

 

<TextBlock FontSize="14" Foreground="Navy" Margin="9,0,0,0" Text="New" OverridesDefaultStyle="True" Height="27" Width="37" />

 

 

 

</StackPanel>

 

 

 

</telerikPresentation:RadButton>

 

Jon
Top achievements
Rank 1
 answered on 02 Nov 2010
4 answers
159 views
Is it possible to pivot the gridview so that columns behave as rows, and vice-versa?  For example, when a row is added, it actually adds a column and the rows stay static.
David Brenchley
Top achievements
Rank 1
 answered on 02 Nov 2010
1 answer
205 views
I am seeing some really terrible performance when scrolling the grid control and coming to the child grids.  Any suggestions on what I could do to make this scroll as well as the sections with out children?  I load my data and force all of the children to be expanded.  So there should be no computation from my code involved with this issue.( currently using q3 2010 beta )

   <telerik:RadGridView 
ItemsSource="{Binding Fields}" 
x:Name="FieldGridView" 
AutoGenerateColumns="False" 
CanUserInsertRows="False" 
CanUserDeleteRows="False" 
CanUserReorderColumns="False" 
CanUserResizeColumns="False" 
CanUserSelect="True" 
CanUserSortColumns="False" 
ClipboardCopyMode="Cells" 
ShowGroupPanel="False" 
SelectionMode="Extended" 
SelectionUnit="Cell" 
RowIndicatorVisibility="Collapsed" 
ColumnWidth="*" 
GridLinesVisibility="Horizontal" 
EnableColumnVirtualization="True" 
            RowDetailsVisibilityMode="Collapsed" 


ShowColumnHeaders="False"  
            RowLoaded="FieldGridViewChild_RowLoaded"

>
         <telerik:RadGridView.Background>
         <SolidColorBrush/>
         </telerik:RadGridView.Background>
            <telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition />
            </telerik:RadGridView.ChildTableDefinitions>

            <telerik:RadGridView.HierarchyChildTemplate>
                <DataTemplate>
                    <telerik:RadGridView 
                        ItemsSource="{Binding Fields}"  
            x:Name="FieldGridViewChild"  
            AutoGenerateColumns="False" 
            CanUserInsertRows="False"  
            CanUserDeleteRows="False"  
            CanUserReorderColumns="False"  
            CanUserResizeColumns="False"  
            CanUserSelect="True"  
            CanUserSortColumns="False" 
            ClipboardCopyMode="Cells" 
            ShowGroupPanel="False" 
            SelectionMode= "Extended" 
            SelectionUnit="Cell" 
                        RowIndicatorVisibility="Collapsed" 
            ColumnWidth="*" 
            GridLinesVisibility="Horizontal" 
            EnableColumnVirtualization="True" 


            ShowColumnHeaders="False" 
                        >
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn 
                                Header="Id"
                    DataMemberBinding="{Binding ID}"  
                    DataFormatString=""  
                    Width="40"  
                    IsReadOnly="True"
                    Background="#E5E5E5"
                                TextAlignment="Right"  />
                            <telerik:GridViewDataColumn
                                Width="*"  
                                
                                TextWrapping="Wrap"
                                DataMemberBinding="{Binding Value}" />
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </DataTemplate>
            </telerik:RadGridView.HierarchyChildTemplate>



            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn
Header="Id" 
DataMemberBinding="{Binding ID}" 
DataFormatString="" 
Width="41" TextAlignment="Right"
IsReadOnly="True"  
Background="LightGray" />
                <telerik:GridViewDataColumn
Width="*" 
TextTrimming="None"
                    TextWrapping="Wrap"
DataMemberBinding="{Binding Value}" />
            </telerik:RadGridView.Columns>

        </telerik:RadGridView>
Vlad
Telerik team
 answered on 02 Nov 2010
2 answers
118 views
I'm playing around with radGauge and have encountered the following ArguementNullException:

System.ArgumentNullException occurred
  Message=Value cannot be null.
Parameter name: reference
  Source=PresentationCore
  ParamName=reference
  StackTrace:
       at System.Windows.Media.VisualTreeHelper.HitTest(Visual reference, Point point)
       at Telerik.Windows.Controls.Gauges.GaugeHelper.CheckPointOver(FrameworkElement element, Point point) in c:\Builds\WPF_Scrum\Release_WPF_2010_Q2_SP2\Sources\Development\Controls\Gauge\GaugeHelper.cs:line 62
  InnerException:

Here's the xaml code used to produce it.  I'm trying to have a gauge with no numerical legends or tick marks with a 360 degree sweep, going from -180 degrees to 180 degrees, with 0 at the top.

<telerik:RadGauge Name="myGauge" Style="{StaticResource gaugeRadGaugeStyle}" >
    <telerik:RadialGauge>
        <telerik:RadialScale Name="radialScale" Min="-180" Max="180" SweepAngle="360" StartAngle="90" >
            <telerik:RadialScale.Label>
                <telerik:LabelProperties Foreground="Transparent" />
            </telerik:RadialScale.Label>
            <telerik:RadialScale.Ticks>
                <telerik:TickProperties Foreground="Transparent" />
                <!--<telerik:MinorTickProperties Foreground="Transparent" />-->
            </telerik:RadialScale.Ticks>
            <telerik:RangeList>
                <telerik:RadialRange Name="SynchroscopeRange" Style="{StaticResource gaugeRadialRangeStyle}" />
            </telerik:RangeList>
            <telerik:IndicatorList>
                <telerik:Needle Name="needle" IsAnimated="true" Value="{Binding Value}"/>
            </telerik:IndicatorList>
        </telerik:RadialScale>
    </telerik:RadialGauge>
</telerik:RadGauge>

Any insight you can provide would be most appreciated!

Thanks!
Bill G
Andrey
Telerik team
 answered on 02 Nov 2010
2 answers
311 views
I am trying to databind xml nodes to hierarchical treeview. I successfully databinded to the first level of XML data source but cannot correctly databind to second and third level.  I am wondering to find out what I am doing wrong. Any similar sample will be highly appreciated. Is that possible to slide out level3 items horizontally while other levels slide out vertically? Thank you in advance.

Here is my XML:
<?xml version="1.0" encoding="utf-8"?>
<Pages xmlns="">
<page name="Name 1" UriSource="Pages/Name1.xaml" />
<page name="Name 2" UriSource="Pages/Name2.xaml" >
  
    <level2 name="ALL1" UriSource="Pages/All1.xaml" />
    <level2 name="ALL2" UriSource="Pages/All2.xaml" />
    <level2 name="ALL3" UriSource="Pages/All3.xaml" />
      
    </page>
    <page name="Name 3" UriSource="Pages/Name3.xaml"/>
        <level2 name="ALL1" UriSource="Pages/All1.xaml" >
            <level3 name="ALL3_1" UriSource="" />
            <level3 name="ALL3_2" UriSource="" />
            <level3 name="ALL3_3" UriSource="" />
        </level2 >  
              
        <level2 name="ALL2" UriSource="Pages/All2.xaml" />
        <level2 name="ALL3" UriSource="Pages/All3.xaml" />
    </page>
      
    <page name="Name 4" UriSource="Pages/Name4.xaml"/>
</Pages>

XAML:
<Window
    xmlns:telerikQuickStart="clr-namespace:Telerik.Windows.Controls.QuickStart;assembly=Telerik.Windows.Controls"
    x:Class="NavPane_2.MainWindow"
    x:Name="Window"
    Title="MainWindow"
    Width="640" Height="480">
      
    <Window.Resources>
        <XmlDataProvider x:Key="PageData" Source="Data/data.xml" XPath="/Pages" />
          
        <HierarchicalDataTemplate x:Key="page" ItemsSource="{Binding XPath=page}"  ItemTemplate="{StaticResource level2}">
            <TextBlock Text="{Binding XPath=@name}" />
       </HierarchicalDataTemplate>
         
        <HierarchicalDataTemplate x:Key="level2" ItemsSource="{Binding XPath=page/level2}" ItemTemplate="{StaticResource level3}">
                <TextBlock Text="{Binding XPath=@name}" />
        </HierarchicalDataTemplate>
  
        <DataTemplate x:Key="level3" ItemsSource="{Binding XPath=page/level2/level3}">
                <TextBlock Text="{Binding XPath=@name}" />
        </DataTemplate>
  
    </Window.Resources>
  
    <Grid x:Name="LayoutRoot">
        <telerikQuickStart:HeaderedContentControl HorizontalAlignment="Center" VerticalAlignment="Center"
            Header="Sample" 
            telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True"
            HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Width="250"
            Height="350">
  
            <telerik:RadTreeView 
                HorizontalAlignment="Left" Margin="8" Background="#FFF9F9F9"
                IsDragDropEnabled="True" SelectionMode="Multiple" IsSingleExpandPath="True" 
                telerik:StyleManager.Theme="Vista" 
                ItemTemplate="{StaticResource page}" 
                ItemsSource="{Binding Source={StaticResource PageData}, XPath=page}" >
        </telerik:RadTreeView>
        </telerikQuickStart:HeaderedContentControl>
    </Grid>
</Window>

Vlad
Top achievements
Rank 1
 answered on 02 Nov 2010
1 answer
184 views
Hi,

I have a problem about how i can control the dropping an Item before or after the root of the RadTreeView.  In my application, some item are not allowed to be dropped before or after a root (i.e some items can not be roots when I have man roots in the treeView).
I can Control the inside dropping using  "IsDropAllowed"  property of the TreeViewItem.

How can I control the "Before"  and "After" dropping?

Thank U for your help.

Alino
Petar Mladenov
Telerik team
 answered on 01 Nov 2010
5 answers
171 views
Hi. I notice that in the sample provided in the ContextMenu where the .IsInEditMode is kind of buggy. Sometime when you do a right click and select on edit, it will go into edit mode and the text will be wiped out. But there is also times in edit mode the text remains in the textblock. Any solution to it?
Petar Mladenov
Telerik team
 answered on 01 Nov 2010
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?