Telerik Forums
UI for WPF Forum
1 answer
108 views
I am using Hiearchial DataTemplates with normal DataTemplate that i saw in one of the forums in here. But i have a problem when the items are displayed properly but it is not expanded when clicked on the items. here is the code that i am using to Display two items at present.
The Link that i saw  this way to display can be found here

XAML:

 

 

 

 

 

<Window.Resources>
        <DataTemplate x:Key="PanelBarItemTemplate">
            <StackPanel Orientation="Vertical">
                <TextBlock Text="{Binding PropertyName}"/>
                <TextBlock Text="{Binding PropertyValue}"/>
                <TextBlock Text="{Binding Comments}"/>
            </StackPanel>
        </DataTemplate>
  
        <HierarchicalDataTemplate x:Key="PanelBarHeaderTemplate"
                           ItemsSource="{Binding Items,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                           ItemTemplate="{StaticResource PanelBarItemTemplate}">
            <TextBlock Text="{Binding Title}" />
        </HierarchicalDataTemplate>
  
    </Window.Resources>
  
    <Grid>
        <DockPanel>
            <DockPanel DockPanel.Dock="Right" Width="350">
                <Label />
            </DockPanel>
            <DockPanel DockPanel.Dock="Right" VerticalAlignment="Bottom">
                <telerik:RadPanelBar ItemsSource="{Binding AccordionItems,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" 
                    ItemTemplate="{StaticResource PanelBarHeaderTemplate}" telerik:StyleManager.Theme="Windows7"/>
            </DockPanel>
        </DockPanel>
    </Grid>

C# ViewModel
public class MainViewModel:ViewModelBase
   {
       public MainViewModel()
       {
           _accordionItems = new List<AccoordionHelper>();
           AccordionItems = new List<AccoordionHelper>();
           _accordionItems.Add(new AccoordionHelper("OffFinalBill", new AccordionItemsHelper(){ Comments="hello", PropertyName="Off Final 1: ", PropertyValue= "12121" }));
           _accordionItems.Add(new AccoordionHelper("PartFinal", new AccordionItemsHelper() { Comments = "hello", PropertyName = "Off Final 1: ", PropertyValue = "12121" }));
           AccordionItems = _accordionItems;
       }
       private List<AccoordionHelper> _accordionItems = new List<AccoordionHelper>();
       public List<AccoordionHelper> AccordionItems
       {
           get
           {
               if (_accordionItems == null)
               {
                   _accordionItems = new List<AccoordionHelper>();
               }
               return _accordionItems;
           }
           set
           {
               _accordionItems = value;
               this.RaisePropertyChanged("AccordionItems");
           }
       }
       
        
   }
   public class AccoordionHelper:ViewModelBase
   {
       private string _title;
       public string Title
       {
           get
           {
               return _title;
           }
           set
           {
               _title = value;
               this.RaisePropertyChanged("Title");
           }
       }
       private AccordionItemsHelper _items;
       public AccordionItemsHelper Items
       {
           get
           {
               if (_items == null)
               {
                   _items = new AccordionItemsHelper();
               }
               return _items;
           }
           set
           {
               _items = value;
               this.RaisePropertyChanged("Items");
           }
       }
       public AccoordionHelper( string title, AccordionItemsHelper items)
       {
           Items=items;
           Title = title;
       }
   }
   public class AccordionItemsHelper
   {
       public string PropertyName { get; set; }
       public string PropertyValue { get; set; }
       public string Comments { get; set; }
   }

Petar Mladenov
Telerik team
 answered on 26 Dec 2011
1 answer
150 views
Is there any way to make the Enter key act like the Tab key for navigating between cells in radgridview?
Dimitrina
Telerik team
 answered on 26 Dec 2011
1 answer
193 views
With the ChartView, how can i get/set the zoom and pan values. I figured out the zoom on the actual control, but it doesn't seem to set the correct "zoom" on the "zoom bar". And pan i can't find anywhere.
Giuseppe
Telerik team
 answered on 26 Dec 2011
3 answers
132 views
I'm trying to create a DataForm that uses a RichTextBox as one of the entry fields. My problem comes in when I try to programmatically set the binding of the RichTextBox. Here's what I have:

private void editCabinetForm_AutoGeneratingField(object sender, Telerik.Windows.Controls.Data.DataForm.AutoGeneratingFieldEventArgs e)
        {
            if (e.PropertyName == "CabinetName")
            {
                e.DataField.Label = "Cabinet Name";
            }
            else if (e.PropertyName == "BriefDescription")
            {
                e.DataField.Label = "Brief Description";
            }
            else if (e.PropertyName == "Comments")
            {
                RadRichTextBox commentsBox = new RadRichTextBox();
                //commentsBox.SetBinding(???, new Binding("Comments"));
                e.DataField.Content = commentsBox;
                e.DataField.Label = "Comments";
            }
            else
            {
                e.Cancel = true;
            }
        }

(Comments is a string variable)

I'm not quite sure what to use for the dependency property - any suggestions?
Vanya Pavlova
Telerik team
 answered on 26 Dec 2011
0 answers
77 views
hi all
i update my dataset . when i exit app and start again my new data is there but when i open database i see new data dont apply.
this is my code :

dBVideoArchiveDataSetArchiveTableTableAdapter.Update(dBVideoArchiveDataSet.ArchiveTable);

 

dBVideoArchiveDataSet.AcceptChanges();

 

radGridView1.Rebind();


thankful.
rastin
Top achievements
Rank 1
 asked on 26 Dec 2011
3 answers
139 views
Hi
     I am currenty developing WPF applications which will consume a wcf data service with works with entity framework 4.1 code first . In WPF application I am using Radgridview and RadDataServiceDataSource

   following the code in XAML page
 
              <telerik:RadDataServiceDataSource Height="100" HorizontalAlignment="Left" Margin="208,242,0,0" Name="radDataServiceDataSource1" VerticalAlignment="Top" Width="100" QueryName="Currency" AutoLoad="True" SubmittingChanges="radDataServiceDataSource1_SubmittingChanges">
            <telerik:RadDataServiceDataSource.DataServiceContext >
                <local:MyBaazaarContext/>
            </telerik:RadDataServiceDataSource.DataServiceContext>
        </telerik:RadDataServiceDataSource>
        <telerik:RadGridView Grid.Row="0" ItemsSource="{Binding DataView, ElementName=radDataServiceDataSource1}" IsBusy="{Binding IsBusy, ElementName=radDataServiceDataSource1}" ShowGroupPanel="False" Name="grdDetails"  />
 
When I am making changes in the gridview an calling   radDataServiceDataSource1.SubmitChanges() nothings getting change.


please Help

Thanks In Advance
Rossen Hristov
Telerik team
 answered on 26 Dec 2011
0 answers
72 views
hi there,

in row_loaded method, we create a multibinding for background. converter is not called in first run.

-populate table (set binding in row_loaded)

-set background on viewmodel

-converter not called.

-clear table

-populate table (again create binding)

-set background, then it is called.

While in debug, when I checked PropertChanged.Target, in first run it is System.ComponentModel.PropertyChangedEventManager  (doesnt work),
and in the second run, it is Telerik.Windows.Data.WeakEvent.WeakListener<System.ComponentModel.PropertyChangedEventArgs>.


Telerik version : 2011.1.411.40


MultiBinding multiBindingBackground = new MultiBinding();
                        multiBindingBackground.Converter = cellColorConverter;
 
 
                        Binding background = new Binding("Background");
                        background.Source = row.Item;                       
                        background.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                        //background.Mode = BindingMode.TwoWay;
                        multiBindingBackground.Bindings.Add(background);
                        multiBindingBackground.Bindings.Add(rcBinding);
                        Binding isBackgroundForBackground = new Binding();
                        isBackgroundForBackground.Source = true;
                        multiBindingBackground.Bindings.Add(isBackgroundForBackground);
                        multiBindingBackground.Bindings.Add(new Binding());
                        cellBase.SetBinding(GridViewCellBase.BackgroundProperty, multiBindingBackground);
CEM
Top achievements
Rank 1
 asked on 26 Dec 2011
4 answers
676 views
Hello,

I have a RadTreeView using a templated ItemsSource bound to a node collection in the view model.  I have implemented a search on the tree, and the found node is programmatically selected within the view model (there is no code in the view).  Do you have an example of how to bring the selected node into view using this type of MVVM structure?

Thanks for any help.
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
 answered on 23 Dec 2011
0 answers
166 views
I'm drawing polyline objects, and when plotted I'm making them draggable. How can I get the coordinates for each point of the polyline after it's been dragged to a different location on the map?

Update: Figured it out (doh!):

 MapPolygon thePolygon = item as MapPolygon;
                if (thePolygon != null)
                {
                    int pointCount = thePolygon.Points.Count - 1;
                    Debug.WriteLine("Number of Points: "+ pointCount);
                }

                Location[] locArray = thePolygon.Points.ToArray();

                foreach(Location loc in locArray)
                {
                    Debug.WriteLine("" + loc.Latitude.ToString());
                    Debug.WriteLine("" + loc.Longitude.ToString());
                }
ejb
Top achievements
Rank 2
 asked on 23 Dec 2011
2 answers
93 views
I noticed that if the RibbonView background is set then the window buttons do not show.
Datafyer
Top achievements
Rank 1
Veteran
 answered on 23 Dec 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?