Telerik Forums
UI for WPF Forum
1 answer
125 views
Hello,

I notice in the release notes for the Q2 2011 SP1 there is nothing mentioned concerning the Image Editor UI control. It was mentioned in another thread that the Q2 2011 SP1 release would contain improvements to the control, but I went ahead and installed the update just to be sure and I didn't notice any changes to the customizability of the control.

Is there a chance I might be overlooking these changes, or should we look forward to the next release for improvements to the Image Editor UI control? Just thought I'd ask.

Thank you for your time,
Kyle
Boby
Telerik team
 answered on 27 Sep 2011
1 answer
138 views
hi,

I am using an Chart with more then one Y-Axis ( multiple data on chart).
I want the user to choose what data to see ( bij checking checkboxes).
When toggling a checkbox the correspondent  Data-Series and Y-Axis should be collapsed ( invisible) .
This works for all the DataSeries,
This works fine for the Main Y-Axis, but does not work for the 'Additional Axis' ) ->

Cannot find governing FrameworkElement or FrameworkContentElement for target element.

code :
 

<telerik:RadChart.DefaultView>
                           <telerik:ChartDefaultView ChartLegendPosition="Top">
                               <telerik:ChartDefaultView.ChartArea>
                                   <telerik:ChartArea x:Name="chartarea" Padding="5,10,20,5" LegendName="legend">
                                       <telerik:ChartArea.AxisX>
                                           <telerik:AxisX DefaultLabelFormat="ddd dd.MM"/>
                                       </telerik:ChartArea.AxisX>
                                       <telerik:ChartArea.AxisY>
                                           <!--<telerik:AxisY Title="Temperatuur (°C)" AxisName="Temperatuur" MinValue="34" MaxValue="44" ExtendDirection="Smart"/>-->
                                           <telerik:AxisY Title="Temperatuur (°C)" AxisName="Temperatuur" MinValue="0" MaxValue="80" Step="10" ExtendDirection="Smart"
                                               Visibility="{Binding Path=IsChecked,ElementName=checkboxViewSeriesTemp, Converter={StaticResource _BooleanToVisibilityYAxisConverter}}">
                                               <telerik:AxisY.AxisStyles>
                                                   <telerik:AxisStyles AxisLineStyle="{StaticResource AxisLineStyleTemp}"
                                                               TickLineStyle="{StaticResource MajorTickLineStyleTemp}"
                                                               MinorTickLineStyle="{StaticResource MinorTickLineStyleTemp}"
                                                               ItemLabelStyle="{StaticResource CustomLabelTemp}"/>
                                               </telerik:AxisY.AxisStyles>
                                           </telerik:AxisY>
                                       </telerik:ChartArea.AxisY>
                                       <telerik:ChartArea.AdditionalYAxes>
                                           <telerik:AxisY  AxisName="Gewicht" Title="Gewicht (Kg)" MinValue="0" MaxValue="200" Step="5" ExtendDirection="Smart"
                                               Visibility="{Binding Path=IsChecked,ElementName=checkboxViewSeriesTemp, Converter={StaticResource _BooleanToVisibilityYAxisConverter}}">                                                
                                               <telerik:AxisY.AxisStyles>
                                                   <telerik:AxisStyles AxisLineStyle="{StaticResource AxisLineStyleGewicht}"
                                                               TickLineStyle="{StaticResource MajorTickLineStyleGewicht}"
                                                               MinorTickLineStyle="{StaticResource MinorTickLineStyleGewicht}"
                                                               ItemLabelStyle="{StaticResource CustomLabelGewicht}"/>
                                               </telerik:AxisY.AxisStyles>
                                           </telerik:AxisY>
                                           <telerik:AxisY  AxisName="Pijn" Title="Pijn (Vas)" MinValue="0" MaxValue="10" Step="1" ExtendDirection="Smart"
                                               Visibility="{Binding Path=IsChecked,ElementName=checkboxViewSeriesPijn, Converter={StaticResource _BooleanToVisibilityYAxisConverter}}">
                                               <telerik:AxisY.AxisStyles>
                                                   <telerik:AxisStyles AxisLineStyle="{StaticResource AxisLineStylePijn}"
                                                                   TickLineStyle="{StaticResource MajorTickLineStylePijn}"
                                                                   MinorTickLineStyle="{StaticResource MinorTickLineStylePijn}"
                                                                   ItemLabelStyle="{StaticResource CustomLabelPijn}"/>
                                               </telerik:AxisY.AxisStyles>
                                           </telerik:AxisY>
Yavor
Telerik team
 answered on 27 Sep 2011
1 answer
92 views
Hello everybody!
I've questions to you and specially Telerik's developers.

1. We changed library from full version Q1 (2011.1.0419.35) to full version Q2 (2011.2.0712.35). Both versions are full and were bought (not any trials).
After this change very important functionality for us - dragging / moving on map after click right button mouse - don't work.
We use Visual Studio 2010 and Team Foundation Server for software development. Our project is made in WPF(C#). 
Any old libraries (Q1) were replaced on new Q2 version (in TFS and local machines).

Interestingly if I make simple project in WPF and use this radmap Q2 version (without any TFS connection) this moving maps functionality works.
What should we do? any idea????

2. We changed Q1 to Q2, because new version has new functionality available by SqlGeospatialDataReader, and .... here is another problem namely: SqlGeospatial gets good data and don't display any polygon or points on informationlayer. Example code is shown below:

xaml:
................
           <telerik:InformationLayer x:Name="layer1" Visibility="Visible">
                <telerik:InformationLayer.Reader>
                    <telerik:SqlGeospatialDataReader x:Name="sqlGeospatialDataReader">
                        
                    </telerik:SqlGeospatialDataReader>
                </telerik:InformationLayer.Reader>
            </telerik:InformationLayer>
.................


code behind:
............
           DBContext.DataClasses1DataContext db = new DBContext.DataClasses1DataContext();

           List<string> mylist = new List<string>();

     


           foreach (var element in db.usp_GetRegions().ToList())
           {
              
               mylist.Add(element.WKT);
              
           }
           sqlGeospatialDataReader.Source = mylist;

at sqlGeospatialDataReader.Source = mylist, the SqGeoSpatialDataReader.Source gets complete list of WKT's as strings. This code has debugged and contains correct data required by SqlGeoSpatialDataReader (I think so :-)). 
usp_GetRegions() is stored procedure that gets data from SQL Server and works fine (return correct format of data).


Can you give (link example or some other) me any example of use this class in codebehind. I tried "List<IEnumerable> mylist" and don't work also.

I will be grateful for help.
Pablo


Andrey
Telerik team
 answered on 27 Sep 2011
1 answer
165 views
Hi,

How can I set the color for the additional y axis so that is same than series color (which uses that y axis)?

In my WPF project chart can include several series and user can change the series color during runtime so I need to set same color to the yaxis also.

I'm using 2011.2.712.40 version of WPF  RadChart

Regards,
Auvo
Evgenia
Telerik team
 answered on 27 Sep 2011
9 answers
1.4K+ views
Hi,

When i debug the LiveData example for Q3 2010 controls, the following debug message is printed every time a new data point is added:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Telerik.Windows.Controls.Charting.ChartLegend', AncestorLevel='1''. BindingExpression:Path=LegendItemMarkerShape; DataItem=null; target element is 'ChartLegendItem' (Name=''); target property is 'MarkerShape' (type 'MarkerShape')


I'm getting the same error message when I use the same control in my project. Both the LiveData example and my project have explicitly set

ShowPointMarks="False"

in the series definition, therefore I'm uncertain why a debug message referencing LegendItemMarkerShape is being generated. Functionally, I'm not encountering any problems, but I'm uncertain whether I should be investigating this debug message. Any insight in what is causing these debug messages?

Kind regards,
Dave.
Yavor
Telerik team
 answered on 27 Sep 2011
1 answer
99 views
Is it possible to align an entire table to the right margin?
Iva Toteva
Telerik team
 answered on 27 Sep 2011
11 answers
312 views
Hi,

I am using Self-Referencing GridView in my WPF project and I am getting the output correctly. But I need the below things to do

1. Make the Header and Panel group for the child gridview as FALSE. Note: I have done it for the Parent Gridview.
2. I am binding the List Collection property to the grid for the child and individual properties for the Parent. I want to make visible false for GUID columns in the child grid (guid is there in the List collection. if i remove from collection, self referencing is not working).

Please help me to solve these issues.

Thanks,
Ram
Ramasamy
Top achievements
Rank 1
 answered on 27 Sep 2011
1 answer
149 views
I have some cells that contain a lot of text content, and they have a set width, so the content gets split into multiple lines, which is what I want. However, when I click on one of these cells to edit it, the row height shrinks down to "single-line" height, so you have to scroll through all the cell text to get to the place you want to edit. Is there an easy way to prevent that from happening? I could calculate the desired height based on the length of the text and the width of the cell and then set it in the PreparedCellForEdit handler, but that seems like a very hackish solution.

Pavel Pavlov
Telerik team
 answered on 27 Sep 2011
2 answers
133 views
Hi all,
We've been experiencing some problems with the content residing inside either the Rad Tab or Rad Pane. We believe the issue is possibly related to the "IsContentPreserved" property, as changing this to true in our initial set up, Rad Tabs, seemed to be a fix.
We've made some changes to the UI, namely hosting the Rad Tabs inside the Docking system, Rad Panes. The problem has reoccurred, although setting the "IsContentPreserved=true" on the Rad PaneGroup hasn't resolved the problem this time. 
Basically the problem we keep experiencing is that UI elements that're inside either the Rad Tabs or Rad Docking Rad Pane Groups which are bound loose the values or possibly the DataContext all together.

Note:
The DataContext is being set from the constructor in the code behind C#, DataContext not bound from the UI in Xaml.


Any help with this would be great, thanks in advance

Nick
Nick Sullivan
Top achievements
Rank 1
 answered on 27 Sep 2011
0 answers
325 views
Hello
I have seen quite a few examples to Save and Load the Gridview settings, but all of them use the IsolatedStorage which is only available for Clickonce applications.
My application is not a Clickonce, hence I cannot use that.
Is there another way to save/load settings?
I have got Telerik Q3 2010 version and am using .NET 3.5
I also tried modifying the RadGridViewSettings class and use IsolatedStorageFile.GetUserStoreForAssembly
as below, but when serializing, I get an error saying:
Type 'System.Windows.Input.Cursor' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.  See the Microsoft .NET Framework documentation for other supported types.

Any ideas?
Regards
Apoorva
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.ComponentModel;
using System.Windows;
using System.Windows.Data;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;
using Telerik.Windows.Controls.GridView;
using System.Windows.Controls;
using System.Runtime.Serialization;
using System.IO;
using System.IO.IsolatedStorage;
using System.ServiceModel;
 
namespace Groupcall.MessengerInvoice
{
    public class RadGridViewSettings
    {
        public RadGridViewSettings()
        {
            //
        }
        public class RadGridViewApplicationSettings : Dictionary<string, object>
        {
            private RadGridViewSettings settings;
 
            private DataContractSerializer serializer = null;
             
            string folderName = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
            string settingsFile;
 
            public RadGridViewApplicationSettings()
            {
                //
            }
 
            public RadGridViewApplicationSettings(RadGridViewSettings settings)
            {
                this.settings = settings;
                settingsFile = Path.Combine(folderName, "Groupcall\\GC Messenger Invoice\\UsageGridSettings.xml");
                List<Type> types = new List<Type>();
                types.Add(typeof(List<ColumnSetting>));
                types.Add(typeof(List<FilterSetting>));
                types.Add(typeof(List<GroupSetting>));
                types.Add(typeof(List<SortSetting>));
                types.Add(typeof(List<PropertySetting>));
                types.Add(typeof(TextBlock));
                types.Add(typeof(System.Windows.Media.MatrixTransform));
 
                this.serializer = new DataContractSerializer(typeof(RadGridViewApplicationSettings), types);
            }
 
            public string PersistID
            {
                get
                {
                    if (!ContainsKey("PersistID") && settings.grid != null)
                    {
                        this["PersistID"] = settings.grid.Name;
                    }
 
                    return (string)this["PersistID"];
                }
            }
 
            public int FrozenColumnCount
            {
                get
                {
                    if (!ContainsKey("FrozenColumnCount"))
                    {
                        this["FrozenColumnCount"] = 0;
                    }
 
                    return (int)this["FrozenColumnCount"];
                }
                set
                {
                    this["FrozenColumnCount"] = value;
                }
            }
 
            public List<ColumnSetting> ColumnSettings
            {
                get
                {
                    if (!ContainsKey("ColumnSettings"))
                    {
                        this["ColumnSettings"] = new List<ColumnSetting>();
                    }
 
                    return (List<ColumnSetting>)this["ColumnSettings"];
                }
            }
 
            public List<SortSetting> SortSettings
            {
                get
                {
                    if (!ContainsKey("SortSettings"))
                    {
                        this["SortSettings"] = new List<SortSetting>();
                    }
 
                    return (List<SortSetting>)this["SortSettings"];
                }
            }
 
            public List<GroupSetting> GroupSettings
            {
                get
                {
                    if (!ContainsKey("GroupSettings"))
                    {
                        this["GroupSettings"] = new List<GroupSetting>();
                    }
 
                    return (List<GroupSetting>)this["GroupSettings"];
                }
            }
 
            public List<FilterSetting> FilterSettings
            {
                get
                {
                    if (!ContainsKey("FilterSettings"))
                    {
                        this["FilterSettings"] = new List<FilterSetting>();
                    }
 
                    return (List<FilterSetting>)this["FilterSettings"];
                }
            }
 
            public void Reload()
            {
                try
                {
                    //using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
                    using (IsolatedStorageFile file=IsolatedStorageFile.GetUserStoreForAssembly())
                    {
                        using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(PersistID, FileMode.Open, file))
                        //using (FileStream stream=new FileStream(settingsFile,FileMode.Open))
                        {
                            if (stream.Length > 0)
                            {
                                RadGridViewApplicationSettings loaded = (RadGridViewApplicationSettings)serializer.ReadObject(stream);
 
                                FrozenColumnCount = loaded.FrozenColumnCount;
 
                                ColumnSettings.Clear();
                                foreach (ColumnSetting cs in loaded.ColumnSettings)
                                {
                                    ColumnSettings.Add(cs);
                                }
 
                                FilterSettings.Clear();
                                foreach (FilterSetting fs in loaded.FilterSettings)
                                {
                                    FilterSettings.Add(fs);
                                }
 
                                GroupSettings.Clear();
                                foreach (GroupSetting gs in loaded.GroupSettings)
                                {
                                    GroupSettings.Add(gs);
                                }
 
                                SortSettings.Clear();
                                foreach (SortSetting ss in loaded.SortSettings)
                                {
                                    SortSettings.Add(ss);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show(ex.Message);
                }
            }
 
            public void Reset()
            {
                try
                {
                    //using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
                    using (IsolatedStorageFile file=IsolatedStorageFile.GetUserStoreForAssembly())
                    {
                        file.DeleteFile(PersistID);
                        //File.Delete(settingsFile);
                    }
                }
                catch
                {
                    //
                }
            }
            public void Save()
            {
                try
                {
                    //using (IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication())
                    using (IsolatedStorageFile file=IsolatedStorageFile.GetUserStoreForAssembly())
                    {
                        using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(PersistID, FileMode.Create, file))
                        //using (FileStream stream=new FileStream(settingsFile, FileMode.Create))
                        {
                            serializer.WriteObject(stream, this);
                        }
                    }
                }
                catch (Exception ex)
                {
                    //
                    MessageBox.Show(ex.Message);
                }
            }
        }
 
        private RadGridView grid = null;
 
        public RadGridViewSettings(RadGridView grid)
        {
            this.grid = grid;
        }
 
        public static readonly DependencyProperty IsEnabledProperty
           = DependencyProperty.RegisterAttached("IsEnabled", typeof(bool), typeof(RadGridViewSettings),
                new PropertyMetadata(new PropertyChangedCallback(OnIsEnabledPropertyChanged)));
 
        public static bool GetIsEnabled(DependencyObject dependencyObject)
        {
            return (bool)dependencyObject.GetValue(IsEnabledProperty);
        }
 
        public static void SetIsEnabled(DependencyObject dependencyObject, bool enabled)
        {
            dependencyObject.SetValue(IsEnabledProperty, enabled);
        }
 
        private static void OnIsEnabledPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            RadGridView grid = dependencyObject as RadGridView;
            if (grid != null)
            {
                if ((bool)e.NewValue)
                {
                    RadGridViewSettings settings = new RadGridViewSettings(grid);
                    settings.Attach();
                }
            }
        }
 
        public virtual void LoadState()
        {
            try
            {
                Settings.Reload();
            }
            catch
            {
                Settings.Reset();
            }
 
            if (this.grid != null)
            {
                grid.FrozenColumnCount = Settings.FrozenColumnCount;
 
                if (Settings.ColumnSettings.Count > 0)
                {
                    foreach (ColumnSetting setting in Settings.ColumnSettings)
                    {
                        ColumnSetting currentSetting = setting;
 
                        GridViewDataColumn column = (from c in grid.Columns.OfType<GridViewDataColumn>()
                                                     where c.UniqueName == currentSetting.UniqueName
                                                     select c).FirstOrDefault();
 
                        if (column != null)
                        {
                            if (currentSetting.DisplayIndex != null)
                            {
                                column.DisplayIndex = currentSetting.DisplayIndex.Value;
                            }
 
                            if (setting.Width != null)
                            {
                                column.Width = new GridViewLength(setting.Width.Value);
                            }
                        }
                    }
                }
                using (grid.DeferRefresh())
                {
                    if (Settings.SortSettings.Count > 0)
                    {
                        grid.SortDescriptors.Clear();
 
                        foreach (SortSetting setting in Settings.SortSettings)
                        {
                            ColumnSortDescriptor d = new ColumnSortDescriptor();
                            d.Column = (from c in grid.Columns.OfType<GridViewBoundColumnBase>()
                                        where c.GetDataMemberName() == setting.PropertyName
                                        select c).FirstOrDefault();
                            d.SortDirection = setting.SortDirection;
 
                            grid.SortDescriptors.Add(d);
                        }
                    }
 
                    if (Settings.GroupSettings.Count > 0)
                    {
                        grid.GroupDescriptors.Clear();
 
                        foreach (GroupSetting setting in Settings.GroupSettings)
                        {
                            ColumnGroupDescriptor d = new ColumnGroupDescriptor();
                            d.Column = (from c in grid.Columns.OfType<GridViewBoundColumnBase>()
                                        where c.GetDataMemberName() == setting.PropertyName
                                        select c).FirstOrDefault();
                            d.SortDirection = setting.SortDirection;
 
                            grid.GroupDescriptors.Add(d);
                        }
                    }
 
                    if (Settings.FilterSettings.Count > 0)
                    {
                        foreach (FilterSetting setting in Settings.FilterSettings)
                        {
                            FilterSetting currentSetting = setting;
 
                            GridViewDataColumn matchingColumn =
                            (from column in grid.Columns.OfType<GridViewDataColumn>()
                             where column.DataMemberBinding.Path.Path == currentSetting.PropertyName
                             select column).FirstOrDefault();
 
                            if (matchingColumn != null)
                            {
                                ColumnFilterDescriptor cfd = new ColumnFilterDescriptor(matchingColumn);
 
                                if (setting.Filter1 != null)
                                {
                                    cfd.FieldFilter.Filter1.Member = setting.Filter1.Member;
                                    cfd.FieldFilter.Filter1.Operator = setting.Filter1.Operator;
                                    cfd.FieldFilter.Filter1.Value = setting.Filter1.Value;
                                }
 
                                if (setting.Filter2 != null)
                                {
                                    cfd.FieldFilter.Filter2.Member = setting.Filter2.Member;
                                    cfd.FieldFilter.Filter2.Operator = setting.Filter2.Operator;
                                    cfd.FieldFilter.Filter2.Value = setting.Filter2.Value;
                                }
 
                                foreach (FilterDescriptorSetting fds in setting.SelectedDistinctValues)
                                {
                                    Telerik.Windows.Data.FilterDescriptor fd = new Telerik.Windows.Data.FilterDescriptor();
                                    fd.Member = fds.Member;
                                    fd.Operator = fds.Operator;
                                    fd.Value = fds.Value;
                                    cfd.DistinctFilter.FilterDescriptors.Add(fd);
                                }
 
                                this.grid.FilterDescriptors.Add(cfd);
                            }
                        }
                    }
                }
            }
        }
 
        public virtual void ResetState()
        {
            Settings.Reset();
        }
 
        public virtual void SaveState()
        {
            Settings.Reset();
 
            if (grid != null)
            {
                if (grid.Columns != null)
                {
                    Settings.ColumnSettings.Clear();
 
                    foreach (Telerik.Windows.Controls.GridViewColumn column in grid.Columns)
                    {
                        if (column is GridViewDataColumn)
                        {
                            GridViewDataColumn dataColumn = (GridViewDataColumn)column;
 
                            ColumnSetting setting = new ColumnSetting();
                            setting.PropertyName = dataColumn.DataMemberBinding.Path.Path;
                            setting.UniqueName = dataColumn.UniqueName;
                            setting.Header = dataColumn.Header;
                            setting.Width = dataColumn.ActualWidth;
                            setting.DisplayIndex = dataColumn.DisplayIndex;
 
                            Settings.ColumnSettings.Add(setting);
                        }
                    }
                }
 
                if (grid.FilterDescriptors != null)
                {
                    Settings.FilterSettings.Clear();
 
                    foreach (IColumnFilterDescriptor cfd in grid.FilterDescriptors.OfType<IColumnFilterDescriptor>())
                    {
                        FilterSetting setting = new FilterSetting();
 
                        if (cfd.FieldFilter.Filter1.Value != Telerik.Windows.Data.FilterDescriptor.UnsetValue)
                        {
                            setting.Filter1 = new Telerik.Windows.Data.FilterDescriptor();
                            setting.Filter1.Member = cfd.FieldFilter.Filter1.Member;
                            setting.Filter1.Operator = cfd.FieldFilter.Filter1.Operator;
                            setting.Filter1.Value = cfd.FieldFilter.Filter1.Value;
                            setting.Filter1.MemberType = null;
                        }
 
                        if (cfd.FieldFilter.Filter2.Value != Telerik.Windows.Data.FilterDescriptor.UnsetValue)
                        {
                            setting.Filter2 = new Telerik.Windows.Data.FilterDescriptor();
                            setting.Filter2.Member = cfd.FieldFilter.Filter2.Member;
                            setting.Filter2.Operator = cfd.FieldFilter.Filter2.Operator;
                            setting.Filter2.Value = cfd.FieldFilter.Filter2.Value;
                            setting.Filter2.MemberType = null;
                        }
 
                        foreach (Telerik.Windows.Data.FilterDescriptor fd in cfd.DistinctFilter.FilterDescriptors.OfType<Telerik.Windows.Data.FilterDescriptor>())
                        {
                            if (fd.Value == Telerik.Windows.Data.FilterDescriptor.UnsetValue)
                            {
                                continue;
                            }
 
                            FilterDescriptorSetting fds = new FilterDescriptorSetting();
                            fds.Member = fd.Member;
                            fds.Operator = fd.Operator;
                            fds.Value = fd.Value;
                            setting.SelectedDistinctValues.Add(fds);
                        }
 
                        setting.PropertyName = cfd.Column.DataMemberBinding.Path.Path;
 
                        Settings.FilterSettings.Add(setting);
                    }
                }
 
                if (grid.SortDescriptors != null)
                {
                    Settings.SortSettings.Clear();
 
                    foreach (ColumnSortDescriptor d in grid.SortDescriptors.OfType<ColumnSortDescriptor>())
                    {
                        SortSetting setting = new SortSetting();
 
                        setting.PropertyName = ((GridViewDataColumn)d.Column).GetDataMemberName();
                        setting.SortDirection = d.SortDirection;
 
                        Settings.SortSettings.Add(setting);
                    }
                }
 
                if (grid.GroupDescriptors != null)
                {
                    Settings.GroupSettings.Clear();
 
                    foreach (ColumnGroupDescriptor d in grid.GroupDescriptors.OfType<ColumnGroupDescriptor>())
                    {
                        GroupSetting setting = new GroupSetting();
 
                        setting.PropertyName = ((GridViewDataColumn)d.Column).GetDataMemberName();
                        setting.SortDirection = d.SortDirection;
 
                        Settings.GroupSettings.Add(setting);
                    }
                }
 
                Settings.FrozenColumnCount = grid.FrozenColumnCount;
            }
 
            Settings.Save();
        }
 
        private void Attach()
        {
            if (this.grid != null)
            {
                this.grid.LayoutUpdated += new EventHandler(LayoutUpdated);
                this.grid.Loaded += Loaded;
                Application.Current.Exit += Current_Exit;
            }
        }
 
        void Current_Exit(object sender, EventArgs e)
        {
            SaveState();
        }
 
        void Loaded(object sender, EventArgs e)
        {
            LoadState();
        }
 
        void LayoutUpdated(object sender, EventArgs e)
        {
            if (grid.Parent == null)
            {
                SaveState();
            }
        }
 
        private RadGridViewApplicationSettings gridViewApplicationSettings = null;
 
        protected virtual RadGridViewApplicationSettings CreateRadGridViewApplicationSettingsInstance()
        {
            return new RadGridViewApplicationSettings(this);
        }
 
        protected RadGridViewApplicationSettings Settings
        {
            get
            {
                if (gridViewApplicationSettings == null)
                {
                    gridViewApplicationSettings = CreateRadGridViewApplicationSettingsInstance();
                }
                return gridViewApplicationSettings;
            }
        }
    }
 
    public class PropertySetting
    {
        string _PropertyName;
        public string PropertyName
        {
            get
            {
                return _PropertyName;
            }
            set
            {
                _PropertyName = value;
            }
        }
    }
 
    public class SortSetting : PropertySetting
    {
        ListSortDirection _SortDirection;
        public ListSortDirection SortDirection
        {
            get
            {
                return _SortDirection;
            }
            set
            {
                _SortDirection = value;
            }
        }
    }
 
    public class GroupSetting : PropertySetting
    {
        ListSortDirection? _SortDirection;
        public ListSortDirection? SortDirection
        {
            get
            {
                return _SortDirection;
            }
            set
            {
                _SortDirection = value;
            }
        }
    }
 
    public class FilterSetting : PropertySetting
    {
        List<FilterDescriptorSetting> _SelectedDistinctValues;
        public List<FilterDescriptorSetting> SelectedDistinctValues
        {
            get
            {
                if (_SelectedDistinctValues == null)
                {
                    _SelectedDistinctValues = new List<FilterDescriptorSetting>();
                }
                return _SelectedDistinctValues;
            }
        }
 
        Telerik.Windows.Data.FilterDescriptor _Filter1;
        public Telerik.Windows.Data.FilterDescriptor Filter1
        {
            get
            {
                return _Filter1;
            }
            set
            {
                _Filter1 = value;
            }
        }
 
        Telerik.Windows.Data.FilterDescriptor _Filter2;
        public Telerik.Windows.Data.FilterDescriptor Filter2
        {
            get
            {
                return _Filter2;
            }
            set
            {
                _Filter2 = value;
            }
        }
    }
 
    public class FilterDescriptorSetting
    {
        string _Member;
        public string Member
        {
            get
            {
                return _Member;
            }
            set
            {
                _Member = value;
            }
        }
 
        Telerik.Windows.Data.FilterOperator _Operator;
        public Telerik.Windows.Data.FilterOperator Operator
        {
            get
            {
                return _Operator;
            }
            set
            {
                _Operator = value;
            }
        }
 
        object _Value;
        public object Value
        {
            get
            {
                return _Value;
            }
            set
            {
                _Value = value;
            }
        }
 
        bool _IsCaseSensitive;
        public bool IsCaseSensitive
        {
            get
            {
                return _IsCaseSensitive;
            }
            set
            {
                _IsCaseSensitive = value;
            }
        }
    }
 
    public class ColumnSetting : PropertySetting
    {
        string _UniqueName;
        public string UniqueName
        {
            get
            {
                return _UniqueName;
            }
            set
            {
                _UniqueName = value;
            }
        }
 
        object _Header;
        public object Header
        {
            get
            {
                return _Header;
            }
            set
            {
                _Header = value;
            }
        }
 
        double? _Width;
        public double? Width
        {
            get
            {
                return _Width;
            }
            set
            {
                _Width = value;
            }
        }
 
        int? _DisplayIndex;
        public int? DisplayIndex
        {
            get
            {
                return _DisplayIndex;
            }
            set
            {
                _DisplayIndex = value;
            }
        }
    }
}
Apoorva
Top achievements
Rank 1
 asked on 26 Sep 2011
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
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
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?