Telerik Forums
UI for WPF Forum
4 answers
197 views
hi,
i have a class that i'm binding to the grid.
this class contain several properties, one of them is value.
property value is of type string.
when all the data in column value is of type int,
sorting it looks something like this:
1
100
150
2
4
...
is there any way that i can numeric string sort it?
1
2
4
100
150
....

thanks!
Rachel
Rachel
Top achievements
Rank 1
 answered on 28 Jul 2010
2 answers
163 views

HI,

I am fairly new to WPF and I am trying to print preview a grid having more than 10 columns . All the columns do not fit on a page for printing. So I would like to continue printing rest of the columns on page 2 . Or if anyother approach , so that the user can see the data for all the columns of the grid.. Here is the sample code. Please let me know.

public static void PrintPreview(Telerik.Windows.Controls.RadGridView grid)
       {
           if (grid != null)
           {
               var dialog = new PrintDialog();
               var capabilities = dialog.PrintQueue.GetPrintCapabilities(dialog.PrintTicket);
               var pageSize = new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight);
               var extentSize = new Size(capabilities.PageImageableArea.ExtentWidth, capabilities.PageImageableArea.ExtentHeight);
               FixedDocument fixedDoc = (PaginateGridInToFixedDocument(ToPrintFriendlyGrid(grid, extentSize), dialog));
               BusinessObjectGridPrintPreviewView previewWindow = new BusinessObjectGridPrintPreviewView();
               previewWindow.RadGridView = grid;
               previewWindow.Document = fixedDoc;
               previewWindow.ShowDialog();
           }
       }
       public static FixedDocument PaginateGridInToFixedDocument(GridViewDataControl element, PrintDialog dialog)
       {
           //var capabilities = dialog.PrintQueue.GetPrintCapabilities(dialog.PrintTicket);
           //var pageSize = new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight);
           //var extentSize = new Size(capabilities.PageImageableArea.ExtentWidth, capabilities.PageImageableArea.ExtentHeight);
           var capabilities = dialog.PrintQueue.GetPrintCapabilities(dialog.PrintTicket);
           Size pageSize = new Size(dialog.PrintableAreaWidth, dialog.PrintableAreaHeight);
           Size extentSize = new Size(capabilities.PageImageableArea.ExtentWidth, capabilities.PageImageableArea.ExtentHeight);
           var fixedDocument = new FixedDocument();
           var totalHeight = 0.0;
           var totalWidth = 0.0;
           element.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
           element.Arrange(new Rect(new Point(0, 0), element.DesiredSize));
           totalHeight = element.DesiredSize.Height;
           //totalWidth = element.DesiredSize.Width;
           List<double> widthBreakList = new List<double>();
           double widthBreakTotal = 0;
           if (element.GroupDescriptors.Count > 0)
           {
               widthBreakTotal = widthBreakTotal + (25 * element.GroupDescriptors.Count);
           }
           double lastBreakLocation = 0;
           widthBreakList.Add(0);
           foreach (Telerik.Windows.Controls.GridViewColumn column in element.Columns)
           {
               if (widthBreakTotal + column.ActualWidth >= (lastBreakLocation + extentSize.Width))
               {
                   widthBreakList.Add(widthBreakTotal);
                   lastBreakLocation = widthBreakTotal;
               }
               else
               {
                   widthBreakTotal += column.ActualWidth;
               }
           }
           totalWidth = widthBreakTotal;
           widthBreakList.Add(totalWidth);
           var yOffset = 0d;
           var xOffset = 0d;
           var xOffsetNext = 0d;
           for (int i = 0; i < (widthBreakList.Count - 1); i++)
           {
               xOffset = widthBreakList[i];
               xOffsetNext = widthBreakList[i + 1];
               yOffset = 0d;
               while (yOffset < totalHeight)
               {
                   var brush = new VisualBrush(element)
                   {
                       Stretch = Stretch.None,
                       AlignmentX = AlignmentX.Left,
                       AlignmentY = AlignmentY.Top,
                       ViewboxUnits = BrushMappingMode.Absolute,
                       TileMode = TileMode.None,
                       Viewbox = new Rect(xOffset, yOffset, xOffsetNext, (extentSize.Height - (extentSize.Height % element.RowHeight)))
                   };
                   var pageContent = new PageContent();
                   var page = new FixedPage();
                   ((IAddChild)pageContent).AddChild(page);
                   fixedDocument.Pages.Add(pageContent);
                   page.Width = pageSize.Width;
                   page.Height = pageSize.Height;
                   var canvas = new Canvas();
                   FixedPage.SetLeft(canvas, capabilities.PageImageableArea.OriginWidth);
                   FixedPage.SetTop(canvas, capabilities.PageImageableArea.OriginHeight);
                   canvas.Width = xOffsetNext - xOffset;
                   canvas.Height = (extentSize.Height - (extentSize.Height % element.RowHeight));
                   canvas.Background = brush;
                   page.Children.Add(canvas);
                   yOffset += extentSize.Height - (extentSize.Height % element.RowHeight);
               }
           }
           return fixedDocument;
       }
       /// <summary>
       /// Convert(Re-create) RadGridView into a print-friendly format
       /// </summary>
       /// <param name="source"></param>
       /// <returns></returns>
       public static GridViewDataControl ToPrintFriendlyGrid(GridViewDataControl source, Size extentSize)
       {
           var grid = new RadGridView()
           {
               ItemsSource = source.ItemsSource,
               RowIndicatorVisibility = Visibility.Collapsed,
               ShowGroupPanel = false,
               CanUserFreezeColumns = false,
               IsFilteringAllowed = false,
               AutoExpandGroups = true,
               AutoGenerateColumns = false,
               ColumnWidth = GridViewLength.SizeToHeader
           };
           grid.ShowColumnFooters = source.ShowColumnFooters;
           grid.ShowGroupFooters = source.ShowGroupFooters;
           grid.ShowColumnHeaders = source.ShowColumnHeaders;
           grid.Width = source.ActualWidth;
           if (source.DataContext is BusinessObjectGridViewModel)
           {
               GridColumnCreator columnCreator = new GridColumnCreator(source.DataContext as BusinessObjectGridViewModel, grid);
               columnCreator.CreateColumns();
               grid.ColumnWidth = GridViewLength.Auto;
               foreach (Telerik.Windows.Controls.GridViewColumn column in grid.Columns)
               {
                   column.Width = GridViewLength.Auto;
                   column.MaxWidth = extentSize.Width;
               }
           }
           else
           {
               foreach (var column in source.Columns.OfType<GridViewDataColumn>())
               {
                   var newColumn = new GridViewDataColumn();
                   newColumn.Header = column.Header;
                   newColumn.DataMemberBinding = new System.Windows.Data.Binding(column.UniqueName);
                   newColumn.Width = column.Width;
                   grid.Columns.Add(newColumn);
               }
               grid.SortDescriptors.AddRange(source.SortDescriptors);
               grid.GroupDescriptors.AddRange(source.GroupDescriptors);
               grid.FilterDescriptors.AddRange(source.FilterDescriptors);
           }
           grid.DataContext = source.DataContext;
           StyleManager.SetTheme(grid, StyleManager.GetTheme(grid));
           return grid;
       }

 

frdotnet
Top achievements
Rank 1
 answered on 28 Jul 2010
2 answers
110 views
Hello,

previously everything worked as expected with RadTabs. Even trying the latest internal builds gave me the same error.
Doing simple things like :

<telerikNavigation:RadTabControl>
            <telerikNavigation:RadTabItem  Padding="4 1" DropDownContent="Slider" IsSelected="True">
                <telerikNavigation:RadTabItem.Header>
                    <Image Source="/Dashboard;component/Resources/test.png" Margin="3" />
                </telerikNavigation:RadTabItem.Header>
                <telerikNavigation:RadTabItem.Content >
   <Image Source="/Dashboard;component/Resources/test.png" Margin="3" />
                </telerikNavigation:RadTabItem.Content>
            </telerikNavigation:RadTabItem>

</telerikNavigation:RadTabControl>

crashes the application. Do you know about this issue or shall I come back with a quick test project to reproduce it?

Thanks,
Emanuel

emi
Top achievements
Rank 1
 answered on 27 Jul 2010
3 answers
157 views
i tried changing the
MainPaletteOrientation="Vertical"

and also
MainPaletteColumnsCount="1"

but it only works when in design mode, not on runtime
Viktor Tsvetkov
Telerik team
 answered on 27 Jul 2010
1 answer
89 views
Hello, I was using the WPF controls, Q1 2010 version in my project and after moving to the new release, I couldn't use several controls, for example NumericElementsPresenter (cannot find a public reference). Can someone tell me how should look the definition and where can I see all the changes made in this new release, what have become obsolete or removed. Thank you i
Rossen Hristov
Telerik team
 answered on 27 Jul 2010
1 answer
89 views
When the DTP is set to not be enabled then the entered values do not show.
The watermark content does, but the entered values do not.

George
Telerik team
 answered on 27 Jul 2010
2 answers
141 views
In a Wpf UserControl , Use a RadDatePicker

As a 
 <telerik:RadDatePicker Name="raddpFrom"  Margin="120,0,186,13"  VerticalAlignment="Bottom" />

After i Show it in a <telerik:RadWindow>

But Not show RadDatePicker other Controlls are Show Correctly

Xaml File

<UserControl x:Class="ZeagReports.Reports.Item.ItemSales"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"                   
     Height="110" Width="400" xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid">
    
        <Grid Height="110" Width="400">
        <Border BorderThickness="3" CornerRadius="10" >
            <Border.BorderBrush>
                <LinearGradientBrush EndPoint=".5,1" StartPoint="0.5,0">
                    <GradientStop Color="#0f7496"  Offset=".1"/>
                    <GradientStop Color="#0f7496" Offset=".5"/>
                    <GradientStop Color="#0f7496"  Offset="1"/>
                </LinearGradientBrush>
            </Border.BorderBrush>            
        </Border>
        <RadioButton HorizontalAlignment="Left" Margin="100,38,0,0" Name="rbtnFixedItem" Width="80" Height="16" VerticalAlignment="Top">Fixed Items</RadioButton>
            <RadioButton HorizontalAlignment="Left" Margin="16,38,0,56" Name="rbtnValidation" Width="80">Validations</RadioButton>

            <Label Height="28" HorizontalAlignment="Left" Margin="12,16,0,0" Name="label1" VerticalAlignment="Top" Width="120">Item Category</Label>
            <Label Height="28" Margin="0,16,116,0" Name="label2" VerticalAlignment="Top" HorizontalAlignment="Right" Width="75">From</Label>
            <Label Height="28" HorizontalAlignment="Right" Margin="0,16,57,0" Name="label3" VerticalAlignment="Top" Width="53">To</Label>
          
            <telerik:RadDatePicker Name="raddpFrom" Height="22" Margin="16,0,0,13" Width="94" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
            <telerik:RadDatePicker Name="raddpTo"  Height="22" Margin="120,0,186,13"  Width="94" VerticalAlignment="Bottom" />
           
            
            
            <telerik:RadButton Margin="0,0,93,12" Name="radBtnPrint" Click="radBtnPrint_Click" Height="23" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75">Print</telerik:RadButton>
            <telerik:RadButton Margin="0,0,12,12" Name="radBtnReset" HorizontalAlignment="Right" Width="75" Click="radBtnReset_Click" Height="23" VerticalAlignment="Bottom">Reset</telerik:RadButton>
            
            
    </Grid>
   
</UserControl>

George
Telerik team
 answered on 27 Jul 2010
5 answers
96 views
Hi,

I have two problems about docking control

1. I don't want to let dragging panes outside the window of app, is there any property I can set?

2. When I add new panes programmically, if there are to many panes on the docking area, the latest pane will be added below the old panes, cause docking do not auto resize the panes, how could I solve this problem?

Thanks for your answer!
George
Telerik team
 answered on 27 Jul 2010
3 answers
156 views

Hello.

I've created simple style for my RadPane.
I'm setting there also DataTemplate of TitleTemplate.
I've got problem to acces programatically the element in this DataTemplate from the class on which this style is applied.
For example I'd like to acces somehow the "PART_ParentControls" element in the following simple style.

Can you please, help ?

I would really appreciate that.

Thanks a lot.

Stefan.

<Style x:Key="TelerikRadPaneStyle" TargetType="{x:Type telDockingControls:RadPane}">  
        <Setter Property="CanUserPin" Value="False" /> 
        <Setter Property="CanFloat" Value="True" /> 
        <Setter Property="CanUserClose" Value="False" /> 
        <Setter Property="ContextMenuTemplate">  
            <Setter.Value> 
                <DataTemplate> 
                    <telNavigationControls:RadContextMenu Visibility="Collapsed" /> 
                </DataTemplate> 
            </Setter.Value> 
        </Setter> 
        <Setter Property="TitleTemplate">  
            <Setter.Value> 
                <DataTemplate > 
                    <Grid > 
                        <Grid.ColumnDefinitions> 
                            <ColumnDefinition Width="*" /> 
                        </Grid.ColumnDefinitions> 
 
                        <Grid Grid.Column="0" x:Name="PART_ParentControls" /> 
 
                    </Grid> 
              </DataTemplate> 
         </Setter.Value> 
    </Setter> 
</Style> 
George
Telerik team
 answered on 27 Jul 2010
2 answers
566 views
Hi..
I'm trying to set  the SELECTEDITEM and/or the SELECTED VALUE of combobox in code

this.cmb.SelectedItem = Customers.Name;

But it doesn't work  any ideas?  It's always null

<radcombox  x:name="cmb"  SelectedValuepath="Name"
SelectedItem = "{Binding Name, Mode=TwoWay}"

thanks

Ravi
Top achievements
Rank 1
 answered on 27 Jul 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
Slider
Expander
TileList
PersistenceFramework
DataPager
TimeBar
Styling
OutlookBar
TransitionControl
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
WebCam
CardView
DataBar
FilePathPicker
Licensing
PasswordBox
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
HighlightTextBlock
Security
TouchManager
StepProgressBar
VirtualKeyboard
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?