Telerik Forums
UI for WPF Forum
2 answers
383 views
Hi, I have a database set up with a Client table and a Project table. Clients have projects, and I set up a Hierarchical Data Template to display them in the treeview. I am now putting functionality in for adding/removing both clients and projects, but I've run into an issue.

Adding and removing Clients (the parent nodes) will update the treeview immediately when I call the INotifyPropertyChanged on the ObservableCollection that it is bound to, but the Projects (the children nodes) won't update until I close the application and start it again.

Here is all the relevant code I can think of:

my xaml:
    <Page.Resources>
        <DataTemplate x:Key="Projects" DataType="{x:Type local:Project}">
            <StackPanel Orientation="Horizontal">
                <Image Source="/Images/Project.png" Height="20" Margin="0,0,8,0" />
                <TextBlock Text="{Binding Name}" />
            </StackPanel>
        </DataTemplate>
        <HierarchicalDataTemplate x:Key="Clients" DataType="{x:Type local:Client}" ItemTemplate="{StaticResource Projects}" ItemsSource="{Binding Projects}">
            <StackPanel Orientation="Horizontal">
                <Image Source="/Images/Client.png" Height="20" Margin="0,0,2,0" />
                <TextBlock Text="{Binding Name}" />   
            </StackPanel>           
        </HierarchicalDataTemplate>
        <Style x:Key="ItemContainerStyle" TargetType="{x:Type telerik:RadTreeViewItem}">
            <Setter Property="Template" Value="{StaticResource SavanetekTreeItem}"/>
        </Style>
    </Page.Resources>
 
<telerik:RadTreeView x:Name="RadTreeView1" Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                         Style="{StaticResource SavanetekTreeViewStyle}" ItemsSource="{Binding ClientList}" SelectedItem="{Binding Path=SelectedObject, Mode=TwoWay}"
                         ItemTemplate="{StaticResource Clients}" ItemContainerStyle="{StaticResource ItemContainerStyle}">
            <telerik:RadTreeView.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="New Client..." Click="MenuItemNewClientDetails_Click" />
                    <MenuItem Header="New Project..." Command="{Binding NewProjectCommand}" />
                    <Separator />
                    <MenuItem Header="Edit..." Click="MenuItemEditClientDetails_Click"/>
                    <Separator />
                    <MenuItem Header="Remove..." />
                </ContextMenu>
            </telerik:RadTreeView.ContextMenu>
        </telerik:RadTreeView>


my remove function:

Public Sub Remove()
        If (IsProject(SelectedObject)) Then
            DB.Projects.DeleteOnSubmit(SelectedObject)
            SubmitChangesToDatabase()
        ElseIf (IsClient(SelectedObject)) Then
            DB.Clients.DeleteOnSubmit(SelectedObject)
            SubmitChangesToDatabase()
        Else
 
        End If
 
        RefreshClientList()
    End Sub

And my code for the ClientList with the Refresh and the function to cast the SelectedObject to a Client or a Project:

Private _clientList As ObservableCollection(Of Client)
    Public Property ClientList() As ObservableCollection(Of Client)
        Get
            Return _clientList
        End Get
        Set(ByVal value As ObservableCollection(Of Client))
            _clientList = value
            OnPropertyChanged("ClientList")
        End Set
    End Property
 
Public Sub RefreshClientList()
        ClientList = New ObservableCollection(Of Client)()
        ClientList = ClientRepo.FindAll()
        OnPropertyChanged("ClientList")
    End Sub


I had tried putting a for each loop in the refresh function that listed all the projects in the ClientList, and it does in fact delete/add the Projects to it, so I know that it has the proper data. It just isn't displaying it for some reason.

I would greatly appreciate if anyone knows how to remove a child from a parent on the treeview and have it refresh
Eric
Top achievements
Rank 1
 answered on 28 Sep 2010
1 answer
125 views

Hello,

I am really hoping that someone can help me. I am new to the Telerik controls and am having an issue with the saving of the layout of a RadDocking control when it is embedded within a RadTabControl's ContentTemplate.

I am saving the layout to a file so I can verify that it is being formatted correctly, however the SerializationTags are not getting output to the file.

Here is a snippet of the XAML to show that I am setting the SerializationTag for my RadDocumentPane:

 

 

 

 

<telerikNavigation:RadTabControl.ContentTemplate>  

 

<DataTemplate>  

 

<Grid>  

 

<radDock:RadDocking x:Name="ResultDocuments" Background="Transparent"

 

 

<radDock:RadDocking.DocumentHost>

 

 

 

 

<radDock:RadSplitContainer SizeChanged="SplitContainer_SizeChanged" >

 

 

 

 

<radDock:RadPaneGroup Name="RadDocumentGroup" Background="Transparent"

 

 

 

                                           radDock:RadDocking.SerializationTag="DocumentGroup">

 

 

 

 

<radDock:RadDocumentPane

 

 

 

                            DataContext="{Binding DataContext,ElementName=ResultDocuments}"

 

 

 

                            Margin="0,0,0,-5" Name="DocumentPane" Title="Documents"

 

 

 

                            radDock:RadDocking.SerializationTag="DocumentPane"

 

 

 

                            HorizontalContentAlignment="Left" CanUserClose="False">

 

 

 

 


Here is a snippet of the output file I am getting:

 

 

 

  <RadDocking>
  <DocumentHost>
  <RadSplitContainer>
  <Items>
  <RadPaneGroup SelectedIndex="0">
  <Items>
  <RadDocumentPane IsDockable="True" Header="Documents" />
  </Items>
  </RadPaneGroup>
  </Items>
  </RadSplitContainer>
  </DocumentHost>

 

 

 

 

Tracy
Top achievements
Rank 1
 answered on 27 Sep 2010
4 answers
793 views
It is necessary to find a specific named element in the CellTemplate of a GridViewColumn.

There is a GridViewColumn defined like this:

<GridViewColumn Header="column 1">
     <GridViewColumn.CellTemplate>
          <DataTemplate>
               <TextBox x:Name="txtcontent"/>
          </DataTemplate>
     </GridViewColumn.CellTemplate>
</GridViewColumn>

It is possible to find an element in a DataTemplate by getting the ContentPresenter where the DataTemplate is applied, and using the FindName method of the DataTemplate to find a specific element.

DataTemplate celltemplate = column.CellTemplate;
ContentPresenter contentpresenter = ...
TextBox txtbox = (TextBox)celltemplate.FindName("txtcontent", contentpresenter);

How can you find the ContentPresenter where the GridViewColumn CellTemplate is applied?
Adam Clark
Top achievements
Rank 1
 answered on 27 Sep 2010
3 answers
294 views
Hi,

I have a situation which my legend text are long. I want to identify the series by placing a text label on the chart area to act as legend. Is there anyway to do that?

Thanks
Evgenia
Telerik team
 answered on 27 Sep 2010
1 answer
205 views
Hi I just ran the Rad Map ItemsVirtualization example from the demo code and I notice certain sluggishness when running the map. Looking at the output window of Visual studio I've noticed a large amount of the errors

A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Any idea why are those thrown?
And also if I increase the density of the grid like the next line of code

 this.dynamicLayer.ZoomGridList.Add(new ZoomGrid(2 << 13, 2 << 13, 13));
the number of the errors increases tremendously.
EDIT>> I looked more into the call stack and this is the error thrown




System.ArgumentOutOfRangeException occurred Message=The added or subtracted value results in an un-representable DateTime.
Parameter name: t
  Source=mscorlib
  ParamName=t
  StackTrace:
       at System.DateTime.op_Addition(DateTime d, TimeSpan t)
  InnerException:

 

Andrey
Telerik team
 answered on 27 Sep 2010
3 answers
185 views
public static bool DisplayInfoMessage1(string strMsg)
        {
           if (MessageBox.Show(strMsg, mstrProjectName, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                return true;
            }
            else
            {
                return false;
            }       
        }

I want to do this using the RadWindow.Confirm box Please Help I try it any times but cannot done it


RadWindow.Confirm(strMsg, new EventHandler<WindowClosedEventArgs>(OnClosed));        can not write inside static Method

private void OnClosed(object sender, WindowClosedEventArgs e)
        {
            
            if (e.DialogResult == true)
            {
                ConfirmationStatus = true;
            }
            else
            {
                ConfirmationStatus = false;
            }
        }
 
ConfirmationStatus  is Public Boolean value.
Miroslav Nedyalkov
Telerik team
 answered on 27 Sep 2010
3 answers
195 views
Hi,
I have created a RadGridView with HierarchyChildTemplate, this template contains DataTemplate which contains RadGridView.
I was wondering how can i get to this RadGridView (inside my template) from code, because I would like to get all selected items in this RadGridView.
Sam Ur
Top achievements
Rank 2
 answered on 27 Sep 2010
1 answer
123 views
Hi,

I have a SumFuncion in my gridviewThis summing all the column values.

I need that when the total sum is negative it appears on screen 0.

Can you help me?

Thanks,
Alexandre Rodrigues
Maya
Telerik team
 answered on 27 Sep 2010
2 answers
96 views
I have a master/detail hierarchy implementation (see attached picture).

I have coded to RowLoaded event to set GridViewRow.IsExpandable = false for master rows whose detail collection is empty.  I wanted to visually show that there were no associated details, and save the user from clicking on the (+) expander control needlessly.  I have set ShowInsertRow="True", and my preference is to keep ShowInsertRow="False".  Instead, I would like to have a button (elsewhere in the UI) to call the BeginInsert() method.  However, how do I target the detail level - particularly if the master row has an empty detail collection?
Wellpartner
Top achievements
Rank 1
 answered on 25 Sep 2010
1 answer
198 views
Hi!

I have a grid which has another grid in its row details. Both grids should have a context menu, however, if I right-click in the row details grid, it shows me the context menu of the parent grid. Is there a way to have it show the child grid's context menu when right-clicking on the child?
Veselin Vasilev
Telerik team
 answered on 24 Sep 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
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?