Telerik Forums
UI for WPF Forum
1 answer
76 views

Hello,

 

I have a class “Priority” which derives from the Category class and fires PropertyChanged when (New) CategoryBrush changes.

I assign the collection of Priority objects to the CategoriesSource property of the ScheduleView control.

The Edit window loads the list fine, but when the brush color of the Category aka Priority changes in the configuration window - the Edit window doesn’t reflect the change. Other controls bound to the CategoryBrush property of the same collection change the color but not the ScheduleView.

Can you see why?

 


Thank you.

Rosi
Telerik team
 answered on 27 Apr 2011
3 answers
82 views

Hi,
  I have just started my adventure with WPF. I have heard that it is dedicated for graphical applications. I'm interested in creating a control that handles linear chart and transform it into chart in a circle. I just wonder if there is some easy way to do that?

Thank you in advance for any reply.

Vladimir Milev
Telerik team
 answered on 27 Apr 2011
1 answer
121 views
I was excited to get a new masking control, but this soon turned to disappointment.  Our users have difficulty with these controls as they are not intuitive.  They expect it to behave the same as if you were entering something into an Excel spreadsheet cell and I don't blame them.  It's confusing to me as well.  I've tried all kinds of variations of textmode, autofill properties, and InputBehavior to get a mask n5.2 to behave properly.  Essentially I think it should behave just as a regular textbox while entering data and display according to the mask when viewing the data.
Alex Fidanov
Telerik team
 answered on 27 Apr 2011
10 answers
887 views
Hi,

Could you please tell me how to disable tabbing inside grid.
Tabbing inside grid is taking me to next cell. I don't want that to happen.

Thanks
Kashi Reddy 

Nedyalko Nikolov
Telerik team
 answered on 27 Apr 2011
2 answers
142 views
Hi,

I'm trying to upgrade my Toolbox to the latest release (2011 Q1 SP1 - 2011.1.419.35) but I keep getting the following error:

Telerik VSExtensions: UpgradeToolbox: Access to registry key 'HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\9.0\Packages\{2c298b35-07da-45f1-96a3-be55d91c8d7a}\Toolbox' is denied. (Toolbox upgrade failed)

I installed the update via the update tool and all worked fine. Then I accidently selected to roll back the Toolbox to the previous version. Now I can't get the latest toolbox to show.

I'm using VS2008. Does anyone know how I can clear the toolbox and get the newer version to show up again? I've tried re-installing the latest release MSI but it hasn't done the trick.

Thank you for your time,

Rob
Robert
Top achievements
Rank 1
 answered on 26 Apr 2011
2 answers
345 views
I have a grid with note types and note subtypes where the ID's for the note subtypes are not unique across all note types, just for the note type they are related to.  Each NoteTpye object has a NoteSubTypes collection property.

Basically they work like below [id]-[value]

1-NoteType1
1-NoteSubType11
2-NoteSubType12
2-NoteType1
1-NoteSubType21
2-NoteSubType22

Because of this when I need to bind the items source of the NoteSubType column to NoteType columns selected NoteType.NoteSubTypes property.  Here's what I have so far:

	    <telerik:RadGridView ItemsSource="{Binding Path=NotesList}" AutoGenerateColumns="False">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn
                        Header="ID"
                        DataMemberBinding="{Binding Path=ID}" />
                    <telerik:GridViewComboBoxColumn
                        Header="NoteType"
                        UniqueName="NoteType"
                        ItemsSource="{Binding Path=NoteTypeList}"
                        DataMemberBinding="{Binding Path=NoteTypeID}"
                        SelectedValueMemberPath="ID"
                        DisplayMemberPath="Name">
                    </telerik:GridViewComboBoxColumn>
 
                    <telerik:GridViewComboBoxColumn
                        Header="NoteSubType"
                        ItemsSource="{???}"
                        DataMemberBinding="{Binding Path=NoteSubTypeID}"
                        SelectedValueMemberPath="ID"
                        DisplayMemberPath="Name">
                        
                    </telerik:GridViewComboBoxColumn>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>

I just need to get the NoteSubType ItemSource.  I have a IValueConverter and IMultiConverter already created for this if we need them (from experimentations with other grids).
Jeremy
Top achievements
Rank 1
 answered on 26 Apr 2011
4 answers
121 views
Hi,

I'm looking for ideas/guidance on how I can achieve the following:

I'd like to save which series are visible/hidden on form unload and restore which series are visible/hidden on form load. For this, I'm wondering how I can access the various Series<<seriesname>>Visibility properties in ExampleViewModel (for example, SeriesEU27Visibility, SeriesEuroAreaVisibility, SeriesJapanVisibility, SeriesUSVisibility) so that they can be read on form unload and then set in form load. In addition to setting these properties on form load, I would like to update the form accordingly to display/hide the correponding series and check/uncheck the corresponding check box in the legend.

I'm fairly new to .NET (I've been coding in VBA instead for over 10 years), so the .NET concepts are new, but programming concepts are familiar to me (I know OO programming concepts from Java, but are new to .NET concepts like ViewModels). I'd really appreciate any ideas or guidance on how I can achieve this.

Many thanks in advance!

Kind regards,
Dave.
David
Top achievements
Rank 2
 answered on 26 Apr 2011
3 answers
296 views
I make a Docking class set with an overwritten behavior.
I save the layout elements.
I make simple heirs of the elements set for docking:


public class TSplitContainer : RadSplitContainer { }
public class TPaneGroup : RadPaneGroup { }
public class TPane : RadPane { }


The RadDocking class has special properties for getting child elements:

d = new TDocking();
//d.CurrentSaveLoadLayoutHelper = new TDefaultSaveLoadLayoutHelper(d);
d.GeneratedItemsFactory = new TDefaultGeneratedItemsFactory();


now I add a special method for creating child elements upon loading:

public class TDocking: RadDocking
{
   protected override void OnElementLoading(LayoutSerializationLoadingEventArgs args)
   {
System.Windows.DependencyObject res = args.AffectedElement;
if (res == null)
{
string st = args.AffectedElementSerializationTag;
if (st == typeof(TDocking).Name)
args.SetAffectedElement(this);
if (st == typeof(TDocumentPane).Name)
args.SetAffectedElement(new TDocumentPane());
if (st == typeof(TPaneGroup).Name)
args.SetAffectedElement(GeneratedItemsFactory.CreatePaneGroup());
if (st == typeof(TSplitContainer).Name)
args.SetAffectedElement(GeneratedItemsFactory.CreateSplitContainer());
}
System.Diagnostics.Debug.WriteLine("OnElementLoading: serializationTag={0}; res={1}", args.AffectedElementSerializationTag, res);
base.OnElementLoading(args);
   }
}


a class for generating child elements.

  
public class TDefaultGeneratedItemsFactory: DefaultGeneratedItemsFactory
{
public override Telerik.Windows.Controls.RadPaneGroup CreatePaneGroup()
{
return new TPaneGroup();
}
public override Telerik.Windows.Controls.RadSplitContainer CreateSplitContainer()
{
return new TSplitContainer();
}
public override ToolWindow CreateToolWindow()
{
return base.CreateToolWindow();
}
}


I make a test method for checking:

d = new TDocking();
//d.CurrentSaveLoadLayoutHelper = new TDefaultSaveLoadLayoutHelper(d);
d.GeneratedItemsFactory = new TDefaultGeneratedItemsFactory();
 
TSplitContainer sc = new TSplitContainer();
d.Items.Add(sc);
TDocking.SetSerializationTag(sc, "TSplitContainer");
sc.InitialPosition = Telerik.Windows.Controls.Docking.DockState.DockedRight;
 
TPaneGroup pg = new TPaneGroup();
TDocking.SetSerializationTag(pg, "TPaneGroup");
sc.Items.Add(pg);
 
TPane pane = new TPane();
TDocking.SetSerializationTag(pane, "TPane");
pg.Items.Add(pane);
d1.LoadLayout(xml);


and now upon calling the LoadLayout method we get the following exception:
   at Telerik.Windows.Controls.Docking.DockingLayoutFactory.GetElementByTypeName(String elementTypeName)
   at Telerik.Windows.Controls.Docking.DockingLayoutFactory.LoadSplitContainer(XmlReader reader)
   at Telerik.Windows.Controls.Docking.DockingLayoutFactory.LoadDocking(XmlReader reader)
   at Telerik.Windows.Controls.RadDocking.LoadLayout(Stream source, Boolean raiseEventsIfNoSerializationTag)
   at Telerik.Windows.Controls.RadDocking.LoadLayout(Stream source)
   at RadarSoft.Report.Wpf.Viewer.TDocking.LoadLayout(String source) in D:\Report\RadarSoft.Report.WPF.Viewer\Controls\TelerikDubles\TDocking.cs:line 39
   at RadarSoft.Report.QuickApp.MainWindow.btnResult_Click(Object sender, RoutedEventArgs e)

now what do we see in the reflector?

public DependencyObject LoadSplitItem(XmlReader reader)
{
if (reader.Name == "RadSplitContainer")
{
return this.LoadSplitContainer(reader);
}
if (reader.Name == "RadPaneGroup")
{
return this.LoadPaneGroup(reader);
}
return null;
}


So, why go into all this trouble of creating child elements, if they are loaded in the splitter like this:

and how am I to cure this now???

p.s. saved xml file:
<?xml version="1.0" encoding="utf-8"?><TDocking><SplitContainers><TSplitContainer SerializationTag="TSplitContainer" Dock="DockedRight" Width="240"><Items><TPaneGroup SerializationTag="TPaneGroup" SelectedIndex="0"><Items><TPane SerializationTag="TPane" IsDockable="True" /></Items></TPaneGroup></Items></TSplitContainer></SplitContainers></TDocking>
Yana
Telerik team
 answered on 26 Apr 2011
1 answer
42 views
Hi,
I have multi DataTable,
i used   seriesMapping.ItemsSource to  Each DataTable,
Error Messenger happend: argument sourceCollection can't null

I sure each DataTable have data
How can i bind this?

Can give me example,
Thanks in advance

Ves
Telerik team
 answered on 26 Apr 2011
1 answer
66 views
Hello!

I got a sample project from telerik team! (235440_loadrowdetails) for hierarchical datagrid.
public class MyViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
  
        private ObservableCollection<Club> clubs;
        private ObservableCollection<Player> players;
        private object selectedItem;
  
        public ObservableCollection<Club> Clubs
        {
            get
            {
                if (this.clubs == null)
                {
                    this.clubs = Club.GetClubs();
                }
  
                return this.clubs;
            }
        }
  
        public ObservableCollection<Player> Players
        {
            get
            {
                if (this.players == null)
                {
                    this.players = Player.GetPlayers();
                }
  
                return this.players;
            }
        }
  
        public object SelectedItem
        {
            get { return this.selectedItem; }
            set
            {
                if (value != this.selectedItem)
                {
                    this.selectedItem = value;
                    this.OnPropertyChanged("SelectedItem");
                }
            }
        }
  
        protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
        {
            PropertyChangedEventHandler handler = this.PropertyChanged;
            if (handler != null)
            {
                handler(this, args);
            }
        }
  
        private void OnPropertyChanged(string propertyName)
        {
            this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
        }
    }
}
  
namespace LoadRowDetails
{
    /// <summary>
    /// A football club.
    /// </summary>
    public class Club : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
  
        private string name;
        private DateTime established;
        private int stadiumCapacity;
        private ObservableCollection<Player> players;
  
        public string Name
        {
            get { return this.name; }
            set
            {
                if (value != this.name)
                {
                    this.name = value;
                    this.OnPropertyChanged("Name");
                }
            }
        }
  
        public DateTime Established
        {
            get { return this.established; }
            set
            {
                if (value != this.established)
                {
                    this.established = value;
                    this.OnPropertyChanged("Established");
                }
            }
        }
  
        public int StadiumCapacity
        {
            get { return this.stadiumCapacity; }
            set
            {
                if (value != this.stadiumCapacity)
                {
                    this.stadiumCapacity = value;
                    this.OnPropertyChanged("StadiumCapacity");
                }
            }
        }
  
        public ObservableCollection<Player> Players
        {
            get
            {
                if (null == this.players)
                {
                    this.players = new ObservableCollection<Player>();
                }
  
                return this.players;
            }
        }
  
        public Club()
        {
  
        }
  
        public Club(string name, DateTime established, int stadiumCapacity)
        {
            this.name = name;
            this.established = established;
            this.stadiumCapacity = stadiumCapacity;
        }
  
        public Club(string name, DateTime established, int stadiumCapacity, ObservableCollection<Player> players)
            : this(name, established, stadiumCapacity)
        {
            this.players = players;
        }
  
        protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
        {
            PropertyChangedEventHandler handler = this.PropertyChanged;
            if (handler != null)
            {
                handler(this, args);
            }
        }
  
        private void OnPropertyChanged(string propertyName)
        {
            this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
        }
  
        public override string ToString()
        {
            return this.Name;
        }
  
        public static ObservableCollection<Club> GetClubs()
        {
            ObservableCollection<Club> clubs = new ObservableCollection<Club>();
            Club club;
  
            // Liverpool
            //club = parent_order
            //club.OrderChain.Add
            club = new Club("Liverpool", new DateTime(1892, 1, 1), 45362);
            club.Players.Add(new Player("Pepe Reina", 25, Position.GK, "Spain"));
            club.Players.Add(new Player("Jamie Carragher", 23, Position.DF, "England"));
            club.Players.Add(new Player("Steven Gerrard", 8, Position.MF, "England"));
            club.Players.Add(new Player("Fernando Torres", 9, Position.FW, "Spain"));
            clubs.Add(club);
  
            // Manchester Utd.
            club = new Club("Manchester Utd.", new DateTime(1878, 1, 1), 76212);
            club.Players.Add(new Player("Edwin van der Sar", 1, Position.GK, "Netherlands"));
            club.Players.Add(new Player("Rio Ferdinand", 5, Position.DF, "England"));
            club.Players.Add(new Player("Ryan Giggs", 11, Position.MF, "Wales"));
            club.Players.Add(new Player("Wayne Rooney", 10, Position.FW, "England"));
            clubs.Add(club);
  
            // Chelsea
            club = new Club("Chelsea", new DateTime(1905, 1, 1), 42055);
            club.Players.Add(new Player("Petr Čech", 1, Position.GK, "Czech Republic"));
            club.Players.Add(new Player("John Terry", 26, Position.DF, "England"));
            club.Players.Add(new Player("Frank Lampard", 8, Position.MF, "England"));
            club.Players.Add(new Player("Nicolas Anelka", 39, Position.FW, "France"));
            clubs.Add(club);
  
            // Arsenal
            club = new Club("Arsenal", new DateTime(1886, 1, 1), 60355);
            club.Players.Add(new Player("Manuel Almunia", 1, Position.GK, "Spain"));
            club.Players.Add(new Player("Gaël Clichy", 22, Position.DF, "France"));
            club.Players.Add(new Player("Cesc Fàbregas", 4, Position.MF, "Spain"));
            club.Players.Add(new Player("Robin van Persie", 11, Position.FW, "Netherlands"));
            clubs.Add(club);
  
            return clubs;
        }
    }
}
...
Now I would like to know how to do this with dynamical data.
How do i have to implement the setter-Methods in MyViewModel?

XAML:
<Grid DataContext="{Binding}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
  
        <telerik:RadGridView Grid.Row="0" 
                             Name="orderGrid" 
                             ItemsSource="{Binding Order_View, UpdateSourceTrigger=PropertyChanged}"
                             IsSynchronizedWithCurrentItem="True"
                             AutoGenerateColumns="False"                          
                             Margin="5">
            <telerik:RadGridView.ChildTableDefinitions>
                <telerik:GridViewTableDefinition />
            </telerik:RadGridView.ChildTableDefinitions>
  
            <telerik:RadGridView.Columns>
  
  
                               <telerik:GridViewColumn Header="Priority">
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <Image Height="20" Source="{Binding PriorityImage}" />
                                <TextBlock  Text="{Binding OrderPriorityShortcut}" Margin="1.2" />
                            </StackPanel>
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewColumn>
  
                       <telerik:GridViewColumn Header="Transport">
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <Image Height="20" Source="{Binding TransportImage}" />
                                <TextBlock  Text="{Binding TransportTypeShortcut}" Margin="1.2" />
                            </StackPanel>
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewColumn>
  
                <telerik:GridViewDataColumn DataMemberBinding="{Binding TransportWay}" Header="Transport Art" IsReadOnly="True"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Device}" Header="Endgerät" IsReadOnly="True" DataContext="{Binding}" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding PickUpTime}" Header="Abholung" IsReadOnly="True"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding ArrivalTime}" Header="Ankunft" IsReadOnly="True"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding OrganisationUnitFrom}" Header="Von" IsReadOnly="True"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding OrganisationUnitTo}" Header="Nach" IsReadOnly="True"/>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding PatientName}" Header="Name" IsReadOnly="True"/>
                <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsInfectious}" Header="Infektiös"/>
            </telerik:RadGridView.Columns>
  
            <telerik:RadGridView.HierarchyChildTemplate>
                <DataTemplate>
                    <telerik:RadGridView Name="orderChainGrid" 
                                         Loaded="orderChain_Loaded"
                                         ItemsSource="{Binding ChainOrders}" 
                                         AutoGenerateColumns="False">
  
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewColumn Header="Priority">
                                <telerik:GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Height="20" Source="{Binding PriorityImage}" />
                                            <TextBlock  Text="{Binding OrderPriorityShortcut}" Margin="1.2" />
                                        </StackPanel>
                                    </DataTemplate>
                                </telerik:GridViewColumn.CellTemplate>
                            </telerik:GridViewColumn>
  
                            <telerik:GridViewColumn Header="Transport">
                                <telerik:GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <Image Height="20" Source="{Binding TransportImage}" />
                                            <TextBlock  Text="{Binding TransportTypeShortcut}" Margin="1.2" />
                                        </StackPanel>
                                    </DataTemplate>
                                </telerik:GridViewColumn.CellTemplate>
                            </telerik:GridViewColumn>
  
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding TransportWay}" Header="Transport Art" IsReadOnly="True"/>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Device}" Header="Endgerät" IsReadOnly="True"/>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding PickUpTime}" Header="Abholung" IsReadOnly="True"/>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding ArrivalTime}" Header="Ankunft" IsReadOnly="True"/>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding OrganisationUnitFrom}" Header="Von" IsReadOnly="True"/>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding OrganisationUnitTo}" Header="Nach" IsReadOnly="True"/>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding PatientName}" Header="Name" IsReadOnly="True"/>
                            <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsInfectious}" Header="Infektiös"/>
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                </DataTemplate>
            </telerik:RadGridView.HierarchyChildTemplate>



In my project I get my data in a background thread. And every time when data changes, my grid should update. Can you post me an "update-Method" for the telerik datagrid?

At the moment, I tried to do the following in my backgroundworker:

this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
          (UpdateGrid)delegate(List<OrderView> ocov)
          {
          this.orderGrid.ItemsSource = ov.DisplayOrders(ref ocov);
          }, e.Result);
but this is not allowed.

Greetings
Ivan Ivanov
Telerik team
 answered on 26 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?