Telerik Forums
UI for WPF Forum
0 answers
114 views
Hi there ,

I need to define maximum input length (like property MaxLength in TextBox) on editing mode in gridview.

<telerik:RadGridView x:Name="ctlStockGridView" AutoGenerateColumns="False" Background="AliceBlue" 
                telerik:StyleManager.Theme="Office_Blue" ShowInsertRow="False" SelectionMode="Extended" 
        RowEditEnded
="ctlStockGridView_RowEditEnded" ValidatesOnDataErrors="None" ShowGroupPanel="False" 
                IsFilteringAllowed="False" RowValidating="ctlStockGridView_RowValidating" 
                PreparingCellForEdit="ctlStockGridView_PreparingCellForEdit">
      <telerik:RadGridView.Columns>
       <telerik:GridViewDataColumn DataMemberBinding="{Binding Amount}" TextAlignment="Right"
     UniqueName="Amount" Header="Posting Amount" Width="auto" HeaderTextAlignment="Center" />
     </telerik:RadGridView.Columns>
</telerik:RadGridView>

please give me some advice.

ps. I'm using version 2010.2.0924.35

Thank you,
SweNz
SweNz
Top achievements
Rank 1
 asked on 05 Aug 2011
1 answer
422 views
I have a drop down button that contains a context menu as the drop down content. I'm binding my ItemsSource of the ContextMenu to a collection of Items on my view model. Because it's inside a DropDownButton, I'm handling the ItemClick event to close the drop down. But I'd like to also use a command on my view model and pass the bound object as the parameter.
Right now, I'm using a DataTemplate, but then I get a menuItem inside a menuItem.
Here is my button and context menu code.
<telerik:RadDropDownButton Content="Assign" DockPanel.Dock="Right" Margin="3" Name="RolesMenu">
   <telerik:RadDropDownButton.DropDownContent>
      <telerik:RadContextMenu ItemsSource="{Binding RolesList}" ItemClick="RolesMenu_ItemClick">
         <telerik:RadContextMenu.ItemTemplate>
            <DataTemplate>
                <telerik:RadMenuItem Header="{Binding RoleName}" Command="{Binding AssignRole}" CommandParameter="{Binding DataContext, RelativeSource={RelativeSource Mode=Self}}" />
            </DataTemplate>
         </telerik:RadContextMenu.ItemTemplate>
      </telerik:RadContextMenu>
   </telerik:RadDropDownButton.DropDownContent>
</telerik:RadDropDownButton>

How can I do the same thing as above without getting a menuItem inside a MenuItem?
Konstantina
Telerik team
 answered on 05 Aug 2011
1 answer
101 views
Please try the next code and fill the difference when the Chart used as DataTemplate and as control.

WPF 4.0 (4.0.30319)
Telerik.Windows.Controls.Charting.dll 2011.2.725.40


Codebehind:
public partial class XAxisTest : Window
    {
        public XAxisTest()
        {
            InitializeComponent();
            InitializeComponent();
            Context = new Context();
            DataContext = this;
        }
        public Context Context { get; set; }
    }
    public class Context
    {
        public Context()
        {
            Charts = new ObservableCollection<ChartDataHolder> { new ChartDataHolder(1), new ChartDataHolder(100) };
        }
        public ChartDataHolder FirstData
        {
            get
            {
                return Charts[0];
            }
        }
        public ObservableCollection<ChartDataHolder> Charts { get; private set; }
    }
    public class ChartDataHolder
    {
        public ChartDataHolder(double delta)
        {
            ChartData = new ObservableCollection<ChartDataItem>();
            for (int i = 0; i < 20; i++)
            {
                ChartData.Add(new ChartDataItem() { ValueX = DateTime.Now.Second + i, ValueY = DateTime.Now.Second * delta + i });
            }
        }
        public ObservableCollection<ChartDataItem> ChartData { get; private set; }
    }
    public class ChartDataItem
    {
        public int ValueX { get; set; }
        public double ValueY { get; set; }
    }

View

<Window>
<Window.Resources>
        <DataTemplate x:Key="measTemplate" x:Shared="false">
            <GroupBox DockPanel.Dock="Bottom" Height="200" Header="I have a legend, but why?">
                <telerik:RadChart ItemsSource="{Binding ChartData, Mode=OneWay}"  >
                    <telerik:RadChart.DefaultView>
                        <telerik:ChartDefaultView>
                            <telerik:ChartDefaultView.ChartLegend>
                                <telerik:ChartLegend Visibility="Collapsed" UseAutoGeneratedItems="True" Header=" " x:Name="chartLegend">
                                </telerik:ChartLegend>
                            </telerik:ChartDefaultView.ChartLegend>
                            <telerik:ChartDefaultView.ChartArea>
                                <telerik:ChartArea LegendName="chartLegend" EnableAnimations="True">
                                    <telerik:ChartArea.AxisX>
                                        <telerik:AxisX />
                                    </telerik:ChartArea.AxisX>
                                    <telerik:ChartArea.AxisY>
                                        <telerik:AxisY DefaultLabelFormat="F2"/>
                                    </telerik:ChartArea.AxisY>
                                </telerik:ChartArea>
                            </telerik:ChartDefaultView.ChartArea>
                        </telerik:ChartDefaultView>
                    </telerik:RadChart.DefaultView>
                    <telerik:RadChart.SeriesMappings>
                        <telerik:SeriesMapping LegendLabel="C">
                            <telerik:SeriesMapping.SeriesDefinition>
                                <telerik:LineSeriesDefinition ShowItemLabels="False"/>
                            </telerik:SeriesMapping.SeriesDefinition>
                            <telerik:ItemMapping FieldName="ValueY" DataPointMember="YValue"/>
                            <telerik:ItemMapping FieldName="ValueX" DataPointMember="XValue"/>
                        </telerik:SeriesMapping>
                    </telerik:RadChart.SeriesMappings>
                </telerik:RadChart>
            </GroupBox>
        </DataTemplate>
            </Window.Resources>
        <DockPanel>


        <GroupBox DockPanel.Dock="Top" Height="200" Header="I have no a legend">
            <telerik:RadChart ItemsSource="{Binding Context.FirstData.ChartData, Mode=OneWay}" Margin="6" >
            <telerik:RadChart.DefaultView>
                <telerik:ChartDefaultView>
                    <telerik:ChartDefaultView.ChartLegend>
                        <telerik:ChartLegend Visibility="Collapsed" UseAutoGeneratedItems="True" Header=" " x:Name="chartLegend1">
                        </telerik:ChartLegend>
                    </telerik:ChartDefaultView.ChartLegend>
                    <telerik:ChartDefaultView.ChartArea>
                        <telerik:ChartArea LegendName="chartLegend1" EnableAnimations="True">
                            <telerik:ChartArea.AxisX>
                                <telerik:AxisX />
                            </telerik:ChartArea.AxisX>
                            <telerik:ChartArea.AxisY>
                                <telerik:AxisY DefaultLabelFormat="F2"/>
                            </telerik:ChartArea.AxisY>
                        </telerik:ChartArea>
                    </telerik:ChartDefaultView.ChartArea>
                </telerik:ChartDefaultView>
            </telerik:RadChart.DefaultView>
            <telerik:RadChart.SeriesMappings>
                <telerik:SeriesMapping LegendLabel="C">
                    <telerik:SeriesMapping.SeriesDefinition>
                        <telerik:LineSeriesDefinition ShowItemLabels="False"/>
                    </telerik:SeriesMapping.SeriesDefinition>
                    <telerik:ItemMapping FieldName="ValueY" DataPointMember="YValue"/>
                    <telerik:ItemMapping FieldName="ValueX" DataPointMember="XValue"/>
                </telerik:SeriesMapping>
            </telerik:RadChart.SeriesMappings>
        </telerik:RadChart>
        </GroupBox>
        <ItemsControl  ItemsSource="{Binding Context.Charts}" ItemTemplate="{StaticResource measTemplate}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <UniformGrid Columns="1" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
    </DockPanel>
</Window>
Yavor
Telerik team
 answered on 05 Aug 2011
1 answer
145 views
Why is the HTML output empty when I include a mergefield in the content of my document?

thanks,

Pablo.
Ivailo Karamanolev
Telerik team
 answered on 05 Aug 2011
2 answers
109 views
Could I enable the mouse wheel scroll in the RadPanelBar control?
Pavel
Top achievements
Rank 1
 answered on 05 Aug 2011
3 answers
172 views
Hi All,

          I am using Telerik WPF Radgridview 2010.2.924.35 version for Printing the contents of gridview. When i select Microsoft XPS Document, a xps file is created and it contains the proper data that is present in the gridview.  When i print the contents after selecting the Printer, i am gettting the correct headers and number of rows and not the cell content. all rows have blank values. What is the problem? i followed the same steps followed in Printing demo in your samples. for the demo sample, i m getting all row values when a printer is selected.

But the only difference is in demo they have used gridviewdatacolumn to bind data. I used celltemplate and celledittemplate to bind row data. Why is the content missing. I also installed 2011 trial version and i ended up with the same issue. Any ideas or help is appreciated. Preferably code samples are welcome.

Thanks in advance,
Saranya.
Maya
Telerik team
 answered on 05 Aug 2011
2 answers
228 views
I am needing to apply celltemplateselectors at runtime to dynamic grid columns from observablecollection<T>.
Do you have any documentation or examples that show applying celltemplateselectors to grid columns in code behind purely?
I have DataTemplates in a Resource Dictionary and I would like to use the business object value in the cell to decide the datatemplate to select.

Example:
private void grid_AutoGeneratingColumn(object sender, GridViewAutoGeneratingColumnEventArgs e)
{
    if (e.Column.UniqueName.Equals("SpecificColumn", StringComparison.CurrentCultureIgnoreCase))
    {
        e.Column.CellTemplateSelector = // ... point to C# class that returns datatemplate from resource dictionary file
    }
}

Guru
Top achievements
Rank 2
 answered on 04 Aug 2011
1 answer
147 views

As a newbie to WPF I've been struggled with triggers and animations for a while. 

This is my element in the information layer:

<telerik:InformationLayer.ItemTemplate>
<DataTemplate>
<Grid x:Name="TopLevelGrid" Width="Auto" Height="Auto"
telerik:MapLayer.Location="{Binding Location}" telerik:MapLayer.BaseZoomLevel="9">
<ToolTipService.ToolTip><ToolTip><ToolTip.Content>
...
</ToolTip.Content></ToolTip></ToolTipService.ToolTip>
<Ellipse Name="myEllipse" Width="20" Height="20"
Stroke="{Binding Stroke}" StrokeThickness="3"StrokeDashArray="2"
Fill="{Binding Fill}" Style="{StaticResource myStyle}" >
<telerik:MapLayer.HotSpot><telerik:HotSpot X="0.5" Y="0.5" /></telerik:MapLayer.HotSpot>
</Ellipse>
</Grid>
</DataTemplate>
</telerik:InformationLayer.ItemTemplate>

The problem is that I want a property (or event) in my custom class for the element to trigger the animation. So far I've tried to do it both in XAML and in code without success.

I would be grateful if you could give me a hint or two of how to solve the issue.

Regards

Robert

Warnestam
Top achievements
Rank 1
 answered on 04 Aug 2011
1 answer
131 views
I have been able to style all of my header columns and the header row, but the Left Gripper all the way to the left of the grid is still using the Office Black theme...what Property controls the LeftGripper Column Header?
Thanks
Vanya Pavlova
Telerik team
 answered on 04 Aug 2011
1 answer
130 views
Hey Telerik,

I'd like to have a reference to the resource column the AppointmentItem is shown in.
This is very useful to change the styling of the appointment based on the column it is shown in.
Since now there is only a reference to the Appointment ViewModel this is not possible.

In my current solution I add a "Resource" dependency property to the Appointment Data Context Proxy, and use reflection on the
groupheader's (GroupKey is the resource) AppointmentItems to set the extra property. However this is done in the a derivative class of the AppointmentsPanel and during it's arrangeoverride, needles to say it degrades performance.

Any suggestions?

Greetz,
Nico
Valeri Hristov
Telerik team
 answered on 04 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?