Telerik Forums
UI for WPF Forum
8 answers
234 views
Hello,

I am creating an application that will bring up a messagebox after an item has been dragged and dropped from one treeview to another.  I would like the messagebox to prompt the user with a Yes/No after the drop is complete on the second treeview.  If the user selects no, the drop can then be canceled.

Thanks
Ryan

RadDragAndDropManager.AddDropInfoHandler(this.CreatedStepItems, new EventHandler<DragDropEventArgs>(this.CreatedStepItems_OnDropInfo));
 
 private void CreatedStepItems_OnDropInfo(object sender, DragDropEventArgs e)
        {
            if (e.Options.Status == DragStatus.DropComplete)
            {
                 
                var t = MessageBox.Show("Cancel", "Cancel", MessageBoxButton.YesNo);
                if (t == MessageBoxResult.Yes)
                    //Cancel
                else
                    //Dont
            }
        }
Petar Mladenov
Telerik team
 answered on 11 Oct 2010
1 answer
331 views

I have the RadGridView setup with

SelectionUnit="Cell"  
SelectionMode="Extended"

Is there any way to highlight the current row (obviously in some color that is not the same as the cell highlight) when I have selected a cell in it?  I was able to make a style that changed the row color when the mouse was over it, but that's not really what I need.

Basically I want it to work like SQL Management Studio does when you click the row number.. it selects the row... but as far as I can tell there is no way to mix the selection mode.
Maya
Telerik team
 answered on 11 Oct 2010
3 answers
249 views
I want to change the CellTemplate and CellEditTemplate of GridViewDataColumn, based on the value of another column.

eg. If Column A has drop down box, with two entries: TextBlock and ComboBox. Based on the selection of column A, I want the column B to have that control.

If you can provide me some sample code that accomplishes this it would be very useful.
Maya
Telerik team
 answered on 11 Oct 2010
2 answers
1.0K+ views

Hi, I am building an application where I need to represent some hierarchical data in a tree. The standard WPF tree fell short on many fronts. So I am doing a trial of your WPF controls.

 

One of the big issues with the standard tree was that it was not (easily) possible to select an item within the tree from outside the tree. I was looking at your documentation, and it clearly shows that you can indeed use the SelectedItem property on your RadTreeView to set the selected item in the tree.

 

So I have implemented your tree and am trying to use that property to set the item, but I cannot get it to work. I have tried both through declarative binding and by setting the property programmatically, and in either case the RadTreeView does not set the correct item on the tree. It simply does nothing.

 

What am I doing wrong? If I can get that feature working with your RadTreeView, along with proper node Double-clicking, we will be purchasing at least developer licenses of the WPF RadControls.

Here is the TreeView code I am doing declaratively:

<t:RadTreeView Grid.Column="0" Grid.Row="2"
        MinHeight="100" MinWidth="100"
        DataContext="{Binding Source={x:Static SizingApp:ProjectManager.Instance}}"
        SelectedItem="{Binding CurrentSelected}">
    <t:RadTreeView.Resources>
        <Style TargetType="{x:Type t:RadTreeViewItem}">
            <Setter Property="IsExpanded" Value="True" />
        </Style>
        <HierarchicalDataTemplate x:Key="LoadTemplate">
            <Grid>
                <TextBlock Text="{Binding Name}">
                    <TextBlock.ContextMenu>
                        <ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
                            <MenuItem InputGestureText="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources,Key=load_ContextMenu_Edit_InputGestureText}"
                                      Click="MenuItem_EditLoadClick">
                                <MenuItem.Header>
                                    <TextBlock Text="{Binding Path=Name,
                                            StringFormat={Resx ResxName=PSSPECApplication.Controls.ProjectControlResources,Key=load_ContextMenu_Edit_Header},
                                            Mode=OneWay}" />
                                </MenuItem.Header>
                            </MenuItem>
                            <MenuItem Click="MenuItem_SaveLoadClick">
                                <MenuItem.Header>
                                    <TextBlock Text="{Binding Path=Name,
                                            StringFormat={Resx ResxName=PSSPECApplication.Controls.ProjectControlResources,Key=load_ContextMenu_Save_Header},
                                            Mode=OneWay}" />
                                </MenuItem.Header>
                            </MenuItem>
                            <MenuItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=load_ContextMenu_SaveAs_Header}"
                                      Click="MenuItem_SaveAsLoadClick" />
                            <MenuItem InputGestureText="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources,Key=load_ContextMenu_Delete_InputGestureText}"
                                      Click="MenuItem_RemoveClick">
                                <MenuItem.Header>
                                    <TextBlock Text="{Binding Path=Name,
                                            StringFormat={Resx ResxName=PSSPECApplication.Controls.ProjectControlResources,Key=load_ContextMenu_Delete_Header},
                                            Mode=OneWay}" />
                                </MenuItem.Header>
                            </MenuItem>
                            <MenuItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources,Key=load_ContextMenu_Copy_Header}"
                                    InputGestureText="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources,Key=load_ContextMenu_Copy_InputGestureText}"
                                    Click="MenuItem_CopyLoadClick" />
                        </ContextMenu>
                    </TextBlock.ContextMenu>
                </TextBlock>
            </Grid>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="StepTemplate"
                ItemsSource="{Binding Loads}"
                ItemTemplate="{StaticResource LoadTemplate}">
            <Grid>
                <TextBlock Text="{Binding Name}">
                    <TextBlock.ContextMenu>
                        <ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
                            <MenuItem InputGestureText="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=step_ContextMenu_Edit_InputGestureText}"
                                      Click="MenuItem_EditStepClick">
                                <MenuItem.Header>
                                    <TextBlock Text="{Binding Path=Name,
                                            StringFormat={Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=step_ContextMenu_Edit_Header},
                                            Mode=OneWay}" />
                                </MenuItem.Header>
                            </MenuItem>
                            <MenuItem Click="MenuItem_SaveStepClick">
                                <MenuItem.Header>
                                    <TextBlock Text="{Binding Path=Name,
                                            StringFormat={Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=step_ContextMenu_Save_Header},
                                            Mode=OneWay}" />
                                </MenuItem.Header>
                            </MenuItem>
                            <MenuItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=step_ContextMenu_SaveAs_Header}"
                                      Click="MenuItem_SaveAsStepClick" />
                            <MenuItem InputGestureText="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=step_ContextMenu_Delete_InputGestureText}"
                                      Click="MenuItem_RemoveClick">
                                <MenuItem.Header>
                                    <TextBlock Text="{Binding Path=Name,
                                            StringFormat={Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=step_ContextMenu_Delete_Header},
                                            Mode=OneWay}" />
                                </MenuItem.Header>
                            </MenuItem>
                            <MenuItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=step_ContextMenu_Copy_Header}"
                                    InputGestureText="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=step_ContextMenu_Copy_InputGestureText}"
                                    Click="MenuItem_CopyStepClick"/>
                            <MenuItem InputGestureText="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=step_ContextMenu_Paste_InputGestureText}"
                                    IsEnabled="{Binding IsLoadCopied, Source={x:Static SizingApp:ProjectManager.Instance}}"
                                    Click="MenuItem_PasteLoadClick">
                                <MenuItem.Header>
                                    <TextBlock Text="{Binding CurrentCopiedLoad,
                                            StringFormat={Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=step_ContextMenu_Paste_Header},
                                            Converter={StaticResource NameConverter},
                                            Source={x:Static SizingApp:ProjectManager.Instance},
                                            Mode=OneWay}" />
                                </MenuItem.Header>
                            </MenuItem>
                            <MenuItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=step_ContextMenu_Import_Load_Header}"
                                    Click="MenuItem_OpenLoadClick"/>
                            <MenuItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=step_ContextMenu_Add_Load_Header}"
                                    ItemsSource="{StaticResource mnuLoadSubmenuCommon}" MenuItem.Click="StepMenuItem_AddLoadClick"/>
                        </ContextMenu>
                    </TextBlock.ContextMenu>
                </TextBlock>
            </Grid>
        </HierarchicalDataTemplate>
        <HierarchicalDataTemplate x:Key="ProjectTemplate"
                ItemsSource="{Binding Steps}"
                ItemTemplate="{StaticResource StepTemplate}">
            <Grid>
                <TextBlock Text="{Binding Name}">
                    <TextBlock.ContextMenu>
                        <ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
                            <MenuItem InputGestureText="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources,Key=project_ContextMenu_Edit_InputGestureText}"
                                      Click="MenuItem_EditProjectClick"
                                      DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}">
                                <MenuItem.Header>
                                    <TextBlock Text="{Binding Path=Name,
                                            StringFormat={Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=project_ContextMenu_Edit_Header},
                                            Mode=OneWay}" />
                                </MenuItem.Header>
                            </MenuItem>
                            <MenuItem Click="MenuItem_SaveProjectClick">
                                <MenuItem.Header>
                                    <TextBlock Text="{Binding Path=Name,
                                            StringFormat={Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=project_ContextMenu_Save_Header},
                                            Mode=OneWay}" />
                                </MenuItem.Header>
                            </MenuItem>
                            <MenuItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=project_ContextMenu_SaveAs_Header}"
                                      Click="MenuItem_SaveAsProjectClick"/>
                            <MenuItem InputGestureText="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=project_ContextMenu_Delete_InputGestureText}"
                                      Click="MenuItem_RemoveClick">
                                <MenuItem.Header>
                                    <TextBlock Text="{Binding Path=Name,
                                            StringFormat={Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=project_ContextMenu_Delete_Header},
                                            Mode=OneWay}" />
                                </MenuItem.Header>
                            </MenuItem>
                            <MenuItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=project_ContextMenu_Copy_Header}"
                                    InputGestureText="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=project_ContextMenu_Copy_InputGestureText}"
                                    Click="MenuItem_CopyProjectClick" />
                            <MenuItem InputGestureText="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=project_ContextMenu_Paste_InputGestureText}"
                                    IsEnabled="{Binding IsStepCopied, Source={x:Static SizingApp:ProjectManager.Instance}}"
                                    Click="MenuItem_PasteStepClick">
                                <MenuItem.Header>
                                    <TextBlock Text="{Binding CurrentCopiedStep,
                                            StringFormat={Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=project_ContextMenu_Paste_Header},
                                            Converter={StaticResource NameConverter},
                                            Source={x:Static SizingApp:ProjectManager.Instance},
                                            Mode=OneWay}" />
                                </MenuItem.Header>
                            </MenuItem>
                            <MenuItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=projectTree_Project_ImportStep_Header}"
                                    Click="MenuItem_OpenStepClick" />
                            <MenuItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=projectTree_Project_AddStep_Header}"
                                    Click="MenuItem_AddStepsClick"/>
                        </ContextMenu>
                    </TextBlock.ContextMenu>
                </TextBlock>
            </Grid>
        </HierarchicalDataTemplate>
    </t:RadTreeView.Resources>
    <t:RadTreeViewItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=projectTree_Header}"
            ItemsSource="{Binding Projects}"
            IsExpanded="True"
            ItemTemplate="{StaticResource ProjectTemplate}">
        <t:RadTreeViewItem.ContextMenu>
            <ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
                <MenuItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=projectTree_NewProject_Header}"
                        Icon="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=addProject_Image_Small}"
                        Click="NewProject_Click"/>
                <MenuItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=projectTree_OpenProject_Header}"
                        Icon="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=openProject_Image_Small}"
                        Click="OpenProject_Click"/>
                <MenuItem Header="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=projectTree_SaveAll_Header}"
                        InputGestureText="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=projectTree_SaveAll_InputGestureText}"
                        Click="SaveAllProjects_Click"/>
                <MenuItem InputGestureText="{Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=projectTree_Paste_InputGestureText}"
                        IsEnabled="{Binding IsProjectCopied, Source={x:Static SizingApp:ProjectManager.Instance}}"
                        Click="MenuItem_PasteProjectClick">
                    <MenuItem.Header>
                        <TextBlock Text="{Binding CurrentCopiedProject,
                                StringFormat={Resx ResxName=PSSPECApplication.Controls.ProjectControlResources, Key=projectTree_Paste_Header},
                                Converter={StaticResource NameConverter},
                                Source={x:Static SizingApp:ProjectManager.Instance},
                                Mode=OneWay}" />
                    </MenuItem.Header>
                </MenuItem>
            </ContextMenu>
        </t:RadTreeViewItem.ContextMenu>
    </t:RadTreeViewItem>
</t:RadTreeView>

Now the Projects property that the first node ItemsSource is bound to works just fine. However, the SelectedItem property on the TreeView itself seems to do nothing. Both the Projects property and the CurrentSelected property are both DependencyProperties. Both have call back event handlers that fire off INotifyPropertyChanged PropertyChanged event handlers indicating the properties have changed. I have other controls on the application that are bound to CurrentSelected and they change along with CurrentSelected just fine.

So why doesn't the RadTreeView also?

Alex Fidanov
Telerik team
 answered on 11 Oct 2010
1 answer
166 views
Hi,

Having a Radbutton

<telerik:RadButton Width="150"  Click="RadButton_Click" Content="Save insert/edit" Margin="0,0,5,0" x:Name="btnSave"
Command="telerikGrid:RadGridViewCommands.CommitEdit" CommandTarget="{Binding ElementName=radGridPhases}" />

I have exsperienced that the click event does not get called, is this correct behavior?.

I want to also update my database, when I click this button. How can I run some exstra code, when clicking this button.

Best regards

Ole
Milan
Telerik team
 answered on 11 Oct 2010
7 answers
231 views
Hi everybody,

the clipboard functionality of the RadGridView is exactly what I need to exchange data with excel. But we also have the requirement to provide the data in additional application specific format. Is there a way to use the standard clipboard functionality for text format and combine it with own functions to provide the data in an application specific format?

Regards Uli
Yavor Georgiev
Telerik team
 answered on 11 Oct 2010
4 answers
86 views
Hi,
I'm brand new to Telerik and I'm feeling kind of stupid.
I have a 2D Stacked Bar Chart

I am trying to refresh the data after a set interval.  I'm creating a dashboard application.
Whenever I refresh the data the new data is just getting added to the old data.
I tried setting the itemsource to nothing but it does not seem to make any difference.

The code I'm using was basically cannibalized from one of the demos and I really don't know what I'm doing.

First off how do I remove the data before adding it again?

Second is there a good place someone can point me to, to learn more about the following objects?
SeriesMapping, DataSeries, ItemMapping, DataPointMember.... I'm having a hard time understanding when to use what.

Thanks in advance and I apologize for my ignorance.
Tim
Vladimir Milev
Telerik team
 answered on 11 Oct 2010
1 answer
166 views
Hi,
I have address types combobox in my RadGridView.
 <telerik:GridViewComboBoxColumn Header="Address Type" Width="100"  Name="AddressTypes" SelectedValueMemberPath="AddressTypeID" DataMemberBinding="{Binding AddressTypeID ,Mode=TwoWay}" DisplayMemberPath="Name"  />

How can I make is eidtable and text complte property etc like in regular combox.
Thanks
Maya
Telerik team
 answered on 11 Oct 2010
5 answers
814 views
Hi
I have a GridView that shows a bunch of rows and has 15 columns, let me name them A1, A2, A3, M1, M2, ...to M12.
Each "M" column can have a value that is either "1" or "0".
I want to show the cell that are "1" with background="Black" and those that are "0" with Background="White".

Following the documentation  I use a class CellTemplateSelector that implement a DataTemplateSelector ( object item, DependencyObject container ).

In the documentation the Template selector is used for formatting one column of the GridView based in its value.So it works for one column in the whole row.

In my case I need to call my CelllTemplateSelector from every "M" column cell in the row and decide what format apply to the cell based on its value (0 or 1).

If I use the Selector implemented in the documentation, I notice that when I call it, I get the parameter "item" that gives me the whole row but I don't know what column I am calling from.

I need to get the column from where I am calling from in order to check for the value of that specific column in order to select the template to apply.

So my question is: How should I call my TemplateSelector and pass the row but also the column name I am calling from.. 

Thanks
Willy Vidable
Top achievements
Rank 1
 answered on 08 Oct 2010
3 answers
148 views
Hi there,

I have a RadChart plotting actual and forecast sales against month using a single LineSeriesDefinition.  I would like to change the colour of the forecasted sales numbers, after the current month.  Is that possible?

Many thanks!

Anthony
Velin
Telerik team
 answered on 08 Oct 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
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
ProgressBar
Sparkline
LayoutControl
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
Rating
Accessibility
Callout
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?