Telerik Forums
UI for WPF Forum
0 answers
155 views

So I have a dynamic RadGridView using MVVM and Caliburn Micro. This means that I add Columns programmatically to the control. basically like this:

for (int i = 0; i < length; i++)
{
    Binding b = new Binding(string.Format("Collection[{0}].ValueIWant", i));
    binding.StringFormat = "{0:0.##}";
    GridViewDataColumn column = new GridViewDataColumn()
    {
        Header = HeaderFor(i),
        DataMemberBinding = b,
        DataType = typeof(double?)
    };

    Control.columns.Add(column);
}

Now I need to add new lines that show the percentage between line 1 and 22 and 3 and so on.

I've managed to do that but I'm not sure how I would manage to change the String.format specifically for those cells instead of the whole column.

CellTemplateSelector came to mind but I'm not sure that is a good idea as this might mean I have to set the binding again, not knowing the value of i and such. Also I only want to change the string.format on the binding.

As I'm manipulating the number as a double (0,5 is 50%, 50 is 5000%) I guess I have to mask the input as well. not sure if String.Format does that for me as well or if I should use RadMaskedInput

Ingólfur
Top achievements
Rank 1
 asked on 31 Aug 2012
6 answers
689 views
I am having a problem displaying the context menu RadContextMenu with Icon, I am using dynamic binding to observable collection, which contains context menu items (Text and Icon), I am following this tutorial "Dynamic Binding", following is my XAML.

<Style x:Key="MenuItemStyle" TargetType="{x:Type telerik:RadMenuItem}">
                <Setter Property="Icon">
                    <Setter.Value>
                        <Image Source="{Binding IconPath, Converter={StaticResource pathtoimage}}" />
                    </Setter.Value>
                </Setter>
            </Style>
 
            <HierarchicalDataTemplate x:Key="MenuItemTemplate">
                <telerik:RadButton Content="{Binding Title}" HorizontalContentAlignment="Left" Background="Transparent" BorderBrush="Transparent" />
            </HierarchicalDataTemplate>

and following is the XAML of RadGridView, on which context menu is placed.

<telerik:RadGridView x:Name="myGridView" AutoGenerateColumns="False" ItemsSource="{Binding GridData}" VerticalAlignment="Top">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Result}" Header="Result"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Category}" Header="Category"/>
            </telerik:RadGridView.Columns>
            <telerik:RadContextMenu.ContextMenu>
                <telerik:RadContextMenu ItemsSource="{Binding ContextMenuItems}" ItemContainerStyle="{StaticResource MenuItemStyle}" ItemTemplate="{StaticResource MenuItemTemplate}">                 
                </telerik:RadContextMenu>

View Model is as follows
class MainViewModel
    {
        private ObservableCollection<MenuItemObj> menuitems_;
        public ObservableCollection<MenuItemObj> ContextMenuItems
        {
            get
            {
                return menuitems_;
            }
            set
            {
                menuitems_ = value;
            }
        }
 
        private ObservableCollection<GridRowDataObj> griddata_;
        public ObservableCollection<GridRowDataObj> GridData
        {
            get
            {
                return griddata_;
            }
            set
            {
                griddata_ = value;
            }
        }
    }
 
    public class MenuItemObj
    {
        public string Title { get; set; }
        public string IconPath { get; set; }
    }
 
    public class GridRowDataObj
    {
        public string Result { set; get; }
        public string Category { set; get; }
    }

and setting DataContext as

//TODO
            ObservableCollection<GridRowDataObj> gd = new ObservableCollection<GridRowDataObj>();
            gd.Add(new GridRowDataObj() { Result = "Matric", Category = "SSC" });
            gd.Add(new GridRowDataObj() { Result = "FSc", Category = "HSSC" });
            gd.Add(new GridRowDataObj() { Result = "FA", Category = "HSSC" });
 
            //TODO
            ObservableCollection<MenuItemObj> mi = new ObservableCollection<MenuItemObj>();
            mi.Add(new MenuItemObj() { Title = "My Item 1", IconPath = "/Images/item1.png" });
            mi.Add(new MenuItemObj() { Title = "My Item 2", IconPath = "/Images/item2.png" });
            mi.Add(new MenuItemObj() { Title = "My Item 3", IconPath = "/Images/item3.png" });
 
            MainViewModel mvm = new MainViewModel();
            mvm.ContextMenuItems = mi;
            mvm.GridData = gd;
 
            this.DataContext = mvm;

What I am getting is like this as in attached file "Menu_Image.png"

I am not sure why the icons for first and second menu items are not displayed, I have checked that the icon is displayed for last menu item only. I have complete project replicating this scenario, I can send you if required, Please help me out?



Muhammad Ummar
Top achievements
Rank 1
 answered on 31 Aug 2012
1 answer
82 views
How   to  label   data  with  "radmap"???

Quetion  one:
     How   to  use  a  pins   which   has  a  tag   to    mark   information???


Quetion  two:

     How   to  mark   the    "Energy  consumption   data"    and    "Water    consumption   data"   on  every  building  of  the  map???   
     Such  as  the  picture  attechment...

    The  picture... 
Andrey
Telerik team
 answered on 31 Aug 2012
0 answers
86 views
I have tried to add in Xaml name, x:name, UniqueName but all do not show up in runtime when i check in the code-behind for the combobox control.

How could I locate the combobox without a name in a switch case scenario?
Neogeo
Top achievements
Rank 1
 asked on 31 Aug 2012
5 answers
124 views
Hi,



We wanted to implement Rad Control Assembly protection in our WPF  application we are developing.

Following the documentation as per the below link



http://www.telerik.com/help/wpf/protecting-telerik-radcontrols-assembly.html



Where can I find the Source code for Rad Controls (WPF) with BUILD instructions.

We are currently using 2012 Q1 release and having plans to upgrade.



Could you kindly provide the Source Code with BUILD instructions for Rad Control Assembly protection or provide me with the resources / Iinks I can refer to and download.



Kindly suggest.



Thank you & Regards,

Phani. 

Phani Kumar
Top achievements
Rank 1
 answered on 30 Aug 2012
2 answers
77 views
Can we use RadTreeView in a root item?

Ex:
---------------------------------------
RootNode1   ( RadPanelBarItem.Header ) <-- Root Item 1
--------------------------------------- 
+ Level1             (RadTreeView)
|---- Level2
.......
---------------------------------------
RootNode2   ( RadPanelBarItem.Header ) <-- Root Item 2 
--------------------------------------- 
+ Level1             (RadTreeView)
|---- Level2
.......

BTW: We are using MVVM, the hierarchical data updates dynamically. 

Thanks.
Chris
Top achievements
Rank 1
 answered on 30 Aug 2012
3 answers
319 views
If the data like below:

RootNode1
- Level1
-- Level2
--- Level3

and I would like to provide a check box to hide Level1 or Level2
Ex: Hide Level1 the output should be 

RootNode1
- Level2
-- Level3  

Ex: Hide Level2 the output should be 

RootNode1
- Level1
-- Level3

Ex: Hide both Level1 and Level2 the output should be 

RootNode1
- Level3


Is possible to do it with RadTreeView?

BTW: we are using RadControl for WPF 2012.2.0725, and the each level in the tree is an ObservableCollection list, and we use converter to convert each list into ListCollectionView to handle sorting and filtering ( http://www.zagstudio.com/blog/434#.UDz-sNaPXng ).


Thanks.

 


Chris
Top achievements
Rank 1
 answered on 30 Aug 2012
1 answer
145 views
Hi,

I have a problem to change th font size of the radpanegroup header when using the metro them.  I have already tried this code :

First :
<telerik:RadPaneGroup FontSize="26" >
<telerik:RadPane x:Name="_outputControl" CanUserClose="True" Header="Output" >
   <ContentControl Grid.Row="0" regions:RegionManager.RegionName="OutputRegion" />                     
</telerik:RadPane>                 
</telerik:RadPaneGroup>


Second :
<Window.Resources>         
<Style x:key="headerStyle" TargetType="telerik:RadPaneGroup" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:MetroTheme, ElementType=telerik:RadPaneGroup}}">             
<Setter Property="FontSize" Value="26"/>         
</Style>    
</Window.Resources>
<telerik:RadPaneGroup  Style="{StaticResource headerStyle}">                     
<telerik:RadPane x:Name="_outputControl" CanUserClose="True" Header="Output" >                         
<ContentControl Grid.Row="0" regions:RegionManager.RegionName="OutputRegion" />                     
</telerik:RadPane>                 
</telerik:RadPaneGroup>
Nothing work, Is there a way to change the font size?

Regards.
Masha
Telerik team
 answered on 30 Aug 2012
4 answers
1.1K+ views
Hi,

Before I begin, this is more of a question about a Popup control rather than the RadRichTextBox itself. Feel free to move this post if you think it should belong in a different section.
I've been creating my own RadRichTextBox Intellisense application where I'm positioning a Popup control based upon the caret position.

I know how to obtain the position of the caret, like so:
Point position = new Point();
 
if (!richTextBox.Document.CaretPosition.Location.IsEmpty)
{
    position = richTextBox.ActiveEditorPresenter.GetViewPointFromDocumentPosition(richTextBox.Document.CaretPosition);
 
    position.Offset(offsetX, offsetY);
    return position;
}

The problem I have is that the Popup placement will alter depending on the size of the Popup/ListBox and if it is positioned towards the top or bottom of the screen.

When the the Popup is showing above my position point (the caret is  the bottom of the screen) it is aligned in the correct place. However, should the caret be towards the top of the screen, the top edge of the Popup is aligned with the top of the caret.

You can better see what I mean from the attached images.

I need to some way to determine if the popup placement is Above or Below my point and adjust the vertical offset accordingly.

Thank you for your time,

Rob
Robert
Top achievements
Rank 1
 answered on 30 Aug 2012
4 answers
339 views
I have a requirement where my Menu Items has to be Disabled/Enabled dynamically based on user Actions. Please let me know if you have an example that does this. My Menu Items are not static and they are Data Driven. 
Rosen Vladimirov
Telerik team
 answered on 30 Aug 2012
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
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
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
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?