Telerik Forums
UI for WPF Forum
3 answers
181 views
The source may contain more than 3000 items at a time. When we navigate the nodes by arrow key, it is very slow.
Please help us with correct property settings for the Telerik Rad Tree for wpf.

Thanks
Petar Mladenov
Telerik team
 answered on 03 Apr 2012
0 answers
114 views
I'm running into an issue with the treelistview. The listview covers several pages, and it renders correctly by default.

However, if I change my font size to "medium" (right click on desktop, choose personalize, choose display, choose medium - 125%), the scrollbar for the treelistview does not allow the end of the content to be reached; the content is truncated.
Eric
Top achievements
Rank 1
 asked on 02 Apr 2012
1 answer
97 views
  • Add a close button in the Header of the DocumentPane

I noticed this note in the release notes for Q1 2012 SP1, but I can't deem to find any information about how to do this (other than old posts about templating).  Is there a property or something I set to turn this on?

Androide
Top achievements
Rank 2
 answered on 02 Apr 2012
2 answers
56 views
  • Add a close button in the Header of the DocumentPane

I noticed this note in the release notes for Q1 2012 SP1, but I can't deem to find any information about how to do this (other than old posts about templating).  Is there a property or something I set to turn this on?

Joe Sharp
Top achievements
Rank 1
 answered on 02 Apr 2012
1 answer
177 views
I have a radcombobox that is being bound to an object. It is an autocomplete textbox, so the items are sent as the user types.

When i clear the selection, or load the page (change binding) the dropdown shows and is open and you have to click inside of it for the dropdown to close.


<telerik:RadComboBox Height="23" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="6,23,0,0"
                                           DisplayMemberPath="LocationName" telerik:TextSearch.TextPath="Address1" IsEditable="True"  
                                           autocomplete:AutocompleteBehavior.MinimumTextLength="3" Text="{Binding Path=Trip.LocationFrom.Address1, Mode=TwoWay}"
                                           EmptyText="Address 1" Width="313" SelectedItem="{Binding Path=Trip.LocationFrom, Mode=TwoWay}">
                          <autocomplete:AutocompleteBehavior.AutocompleteProvider>
                              <autocompleteprovider:LocationAutocompleteProvider TextPath="LocationName" />
                          </autocomplete:AutocompleteBehavior.AutocompleteProvider>
                      </telerik:RadComboBox>



Attached is an image of the behavior as well.

Keith
Top achievements
Rank 1
 answered on 02 Apr 2012
1 answer
215 views
Hi @ All,

i have a little Problem with the RadDocking Control. If have three containers: Top Right and Bottom. When i run the application and want to change the size of andy Container, by click and mouse moove this container gets the maximum size and all other Container are no longer visible. Please take a look to the two png-files.

Where ist the Problem? Here ist the xaml:

<telerik:RadDocking x:Name="Docking" telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True"  BorderThickness="0" Padding="0" telerik:StyleManager.Theme="Summer" Grid.Row="1"
                    FontFamily="Calibri" FontSize="14" Margin="0,5,0,0">
     
    <telerik:RadDocking.DocumentHost>
        <telerik:RadSplitContainer InitialPosition="DockedTop">
            <telerik:RadPaneGroup x:Name="DocumentGroup" AllowDragOverTab="True">
                <telerik:RadPane x:Name="allgemein" Header="{Binding Source={StaticResource Lang}, XPath=KundenDetailAllgemein/@Header}" telerik:RadDocking.SerializationTag="LayoutXml" telerik:RadDocking.FloatingSize="450, 400">                                          
                </telerik:RadPane>
 
                <telerik:RadPane Header="{Binding Source={StaticResource Lang}, XPath=KundenDEtailKarte/@Header}" telerik:RadDocking.SerializationTag="DocumentPane">
                    <Frame x:Name="Map_frm" Source="../Controls/Map/Map.xaml" />
                </telerik:RadPane>
            </telerik:RadPaneGroup>
        </telerik:RadSplitContainer>
    </telerik:RadDocking.DocumentHost>                           
     
    <telerik:RadSplitContainer InitialPosition="DockedRight">
        <telerik:RadPaneGroup>
            <telerik:RadPane Header="Pane Right 1" telerik:RadDocking.SerializationTag="PaneRight1">
                <telerik:RadTreeView>
                    <telerik:RadTreeViewItem Header="RootItem">
                        <telerik:RadTreeViewItem Header="Item1" />
                        <telerik:RadTreeViewItem Header="Item2">
                            <telerik:RadTreeViewItem Header="Item21" />
                            <telerik:RadTreeViewItem Header="Item22" />
                            <telerik:RadTreeViewItem Header="Item23">
                                <telerik:RadTreeViewItem Header="Item231" />
                            </telerik:RadTreeViewItem>
                        </telerik:RadTreeViewItem>
                        <telerik:RadTreeViewItem Header="Item3" />
                    </telerik:RadTreeViewItem>
                </telerik:RadTreeView>
            </telerik:RadPane>
        </telerik:RadPaneGroup>
    </telerik:RadSplitContainer>
 
     
    <telerik:RadSplitContainer InitialPosition="DockedBottom">
        <telerik:RadPaneGroup>
            <telerik:RadPane Header="{Binding Source={StaticResource Lang}, XPath=KundenDetailAktion/@Header}" telerik:RadDocking.SerializationTag="PaneTop1">                                                                              
                 
            </telerik:RadPane>
        </telerik:RadPaneGroup>
    </telerik:RadSplitContainer>                           
</telerik:RadDocking>

Thanks a lot
regards
ww
ITA
Top achievements
Rank 1
 answered on 02 Apr 2012
5 answers
384 views
Hi there,

I want to be able to do the following and don't seem to be able to:

Let's say I have property A, B and C.

  • A is a Boolean (checkbox).
  • If I choose A as checked option C is editable, otherwise option C is readonly.

Where/how do I override the enabled/readonly properties of the property definition based on another property's value/state?

I have disabled autopropertygeneration and am binding using my own xaml and model.

David
Top achievements
Rank 1
 answered on 02 Apr 2012
2 answers
73 views
Hi there,

I installed VS 11 beta and the RadControls for WPF 12.1.326.0.
After using the Telerik - WPF - ToolboxConfigurator, my VS doesn't work. It runs into an unstable condition always when initializing the Toolbox.
And it tries to initialize every time I load this project because it never finished initialization.
So I can't use the controls on a WPF-Application.

Any idea??
Chavdar Dimitrov
Telerik team
 answered on 02 Apr 2012
5 answers
329 views

Hi,

I'm using Telerik V2011.3.1220.35 and when I try to persist dialog I have some problems.

Here is the errors I have in my log:
-----------------------------------------
1. Error occured during 'Load' file. Message: DisplayIndex out of range! Date
Nom du paramètre : displayIndex

2. Error occured during 'Save' file. Message: Impossible d'effectuer un cast d'un objet de type 'Telerik.Windows.Data.SortDescriptor' en type 'Telerik.Windows.Controls.GridView.ColumnSortDescriptor'.

3. When I run my application in my Visual Studion environment, I can see a lot of :

 

A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll

 

that occured when I try to load from my PersistenceStorage class and the file to load does not exist. Do we have something we can do before loading a persisted file to see if the file exist?

Here is my class:
---------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;

using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Data;
using Telerik.Windows.Documents.FormatProviders.Txt;
using Telerik.Windows.Persistence;
using Telerik.Windows.Persistence.Services;
using Telerik.Windows.Persistence.Storage;
using Telerik.Windows.Zip;

using com.christiegrp.Neuron.Client;
using com.ChristieGrp.Infrastructure;

namespace com.christiegrp.Neuron.ClientApplication
{
    static public class PersistenceStorage
    {       
        #region Public methods.
        /// <summary>
        /// Load/Save all controls that contain "telerik:PersistenceManager.StorageId="..."
        /// The file location is "$APPDATA\IsolatedStorage\..."
        /// </summary>
        /// <param name="pPersistenceAction">Load/Save</param>
        /// <param name="pErrorMessage">Error received during the persistence.</param>
        /// <returns>true if successfull otherwise false</returns>
        static public bool Persist(PersistenceAction pPersistenceAction, out string pErrorMessage)
        {           
            pErrorMessage = string.Empty;
            PersistenceManager manager = new PersistenceManager();
            manager.PropertyPersisting += new Telerik.Windows.Persistence.Events.PropertyPersistingEventHandler(manager_PropertyPersisting);
            IsolatedStorageProvider storage = new IsolatedStorageProvider(manager);

            try
            {
                try
                {
                    if (pPersistenceAction == PersistenceAction.Load)
                    {
                        storage.LoadFromStorage(); // TO CHECK
                    }
                    else if (pPersistenceAction == PersistenceAction.Save)
                    {
                        storage.SaveToStorage(); // TO CHECK
                    }

                    return true;
                }
                catch (Exception ex)
                {
                    GclLogger tracingTool = GclLogger.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                    tracingTool.Log(GclLogger.Level.Error, "PERST001", "Error occured during '{0}' file. Message: {1}", pPersistenceAction.ToString(), ex.Message.ToString());
                    pErrorMessage = ex.Message;
                    return false;
                }
            }
            finally
            {
                manager.PropertyPersisting += new Telerik.Windows.Persistence.Events.PropertyPersistingEventHandler(manager_PropertyPersisting);
            }
        }

        /// <summary>
        /// Load/Save from/to stream object.
        /// </summary>
        /// <param name="pDataSource">If different from null, we persist load/save from/in database.</param>
        /// <param name="pObject">Object to load/save.</param>
        /// <param name="pStream">Stream that contain the serialized object. Object content is ignored if pDatabaseStorage is true.</param>
        /// <param name="pPersistenceAction">Load/Save</param>       
        /// <param name="pErrorMessage">Error received during the persistence.</param>
        /// <returns></returns>
        static public bool Persist(NeuronDataSource pDataSource, object pObject, ref Stream pStream, PersistenceAction pPersistenceAction, out string pErrorMessage)
        {
            // TODO: Compress/Uncompress the stream before save/load to/from database.

            mResult = true;
            pErrorMessage = string.Empty;
            PersistenceManager manager = new PersistenceManager();
            manager.PersistenceError += new Telerik.Windows.Persistence.Events.PersistenceErrorEventHandler(manager_PersistenceError);
            manager.PropertyPersisting += new Telerik.Windows.Persistence.Events.PropertyPersistingEventHandler(manager_PropertyPersisting);

            try
            {
                if (pPersistenceAction == PersistenceAction.Load)
                {
                    if (pObject != null && pStream != null)
                    {
                        pStream.Position = 0L; // TO CHECK
                        manager.Load(pObject, pStream); // TO CHECK
                    }
                    else
                    {
                        pErrorMessage = "pObject and/or pStream cannot be null.";
                        GclLogger tracingTool = GclLogger.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                        tracingTool.Log(GclLogger.Level.Error, "PERST005", "Error occured during '{0}' stream. Message: {1}", pPersistenceAction.ToString(), pErrorMessage);
                        mResult = false;
                    }
                }
                else if (pPersistenceAction == PersistenceAction.Save)
                {
                    if (pObject != null)
                    {
                        pStream = manager.Save(pObject); // TO CHECK
                    }
                    else
                    {
                        pErrorMessage = "pObject cannot be null.";
                        GclLogger tracingTool = GclLogger.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                        tracingTool.Log(GclLogger.Level.Error, "PERST006", "Error occured during '{0}' stream. Message: {1}", pPersistenceAction.ToString(), pErrorMessage);
                        mResult = false;
                    }
                }
            }
            catch (Exception ex)
            {
                GclLogger tracingTool = GclLogger.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                tracingTool.Log(GclLogger.Level.Error, "PERST002", "Error occured during '{0}' stream. Message: {1}", pPersistenceAction.ToString(), ex.Message.ToString());
                pErrorMessage = ex.Message;
                mResult = false;
            }
            finally
            {
                manager.PersistenceError -= new Telerik.Windows.Persistence.Events.PersistenceErrorEventHandler(manager_PersistenceError);
                manager.PropertyPersisting -= new Telerik.Windows.Persistence.Events.PropertyPersistingEventHandler(manager_PropertyPersisting);
                pErrorMessage = mErrorMessage;
            }

            return mResult;
        }

        /// <summary>
        /// Deleting all persistence files.
        /// </summary>
        /// <param name="pErrorMessage">Error receiving during deleting files.</param>
        static public void DeleteAll(out string pErrorMessage)
        {
            pErrorMessage = string.Empty;
            IsolatedStorageProvider iso = new IsolatedStorageProvider();
            try
            {
                iso.DeleteIsolatedStorageFiles();
            }
            catch (Exception ex)
            {
                GclLogger tracingTool = GclLogger.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                tracingTool.Log(GclLogger.Level.Error, "PERST007", "Error occured during deleting files. Message: {0}", ex.Message.ToString());
                pErrorMessage = ex.Message;
            }
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="input"></param>
        /// <param name="output"></param>
        private static void copyTo(Stream input, Stream output)
        {
            byte[] buffer = new byte[32768]; // Fairly arbitrary size
            int bytesRead;

            while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0)
            {
                output.Write(buffer, 0, bytesRead);
            }
        }

        /// <summary>
        /// Uncompress a stream.
        /// </summary>
        /// <param name="pStreamIn"></param>
        /// <param name="pStreamOut"></param>
        /// <returns></returns>
        private static bool uncompressStream(MemoryStream pStreamIn, out Stream pStreamOut)
        {
            pStreamOut = null;
            try
            {   
                //TODO: Uncompress stream
                return true;
            }
            catch (Exception ex)
            {
                GclLogger tracingTool = GclLogger.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                tracingTool.Log(GclLogger.Level.Error, "PERST003", "{0}", ex.Message.ToString());
                mErrorMessage = ex.Message;
                return false;
            }
        }

        /// <summary>
        /// Compream a stream.
        /// </summary>
        /// <param name="pStreamIn"></param>
        /// <param name="pStreamOut"></param>
        /// <returns></returns>
        private static bool compressStream(ref Stream pStreamIn, out MemoryStream pStreamOut)
        {
            pStreamOut = null;
            try
            {
                pStreamOut = new MemoryStream();
                ZipPackage package = ZipPackage.Create(pStreamOut);
                package.AddStream(pStreamIn, "WindowPersistedData");
                pStreamIn.Position = 0L;
                return true;
            }
            catch (Exception ex)
            {
                GclLogger tracingTool = GclLogger.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
                tracingTool.Log(GclLogger.Level.Error, "PERST004", "{0}", ex.Message.ToString());
                mErrorMessage = ex.Message;
                return false;
            }
        }

        /// <summary>
        /// Event triggered when the stream persistence didn't worked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        static void manager_PersistenceError(object sender, Telerik.Windows.Persistence.Events.PersistenceErrorEventArgs e)
        {
            mErrorMessage = e.Exception.Message;
            mResult = false;
            throw new NotImplementedException();
        }

        /// <summary>
        /// This event is used to prevent any BroderBrush to have a transparent color when we persist an object.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        static void manager_PropertyPersisting(object sender, Telerik.Windows.Persistence.Events.PersistingPropertyEventArgs e)
        {
            //Not needed since version 2011.3.1116.35 of Telerik
            //if (e.Name == "BorderBrush")
            //    e.Cancel = true;
        }
        #endregion

        #region Private declarations.
        /// <summary>
        /// Persist a streaming object into or from database.
        /// </summary>
        /// <param name="pAction"></param>
        /// <param name="pStream"></param>
        /// <returns></returns>
        static private Boolean databaseStorage(PersistenceAction pAction, ref MemoryStream pStream)
        {
            Boolean result = true;

            if (pAction == PersistenceAction.Load)
            {
                throw new NotImplementedException();
            }
            else if (pAction == PersistenceAction.Save)
            {
                throw new NotImplementedException();
            }
           
            return result;
        }
        #endregion

        #region Enumerators.
        public enum PersistenceAction { Load, Save }
        #endregion

        #region Private declarations.
        static private string mErrorMessage;
        static private bool mResult;
        #endregion
    }

    //====================================================================================
    //
    //====================================================================================
    public class DockingCustomPropertyProvider : ICustomPropertyProvider
    {
        public CustomPropertyInfo[] GetCustomProperties()
        {
            // Create two custom properties to serialize the Layout of the RadDocking and the Content of the RadPanes
            return new CustomPropertyInfo[]
        {
            new CustomPropertyInfo("Layout", typeof(string)),
            new CustomPropertyInfo("Content", typeof(List<PaneProxy>)) { AllowCreateInstance =false, TreatAsUI = false},
        };
        }

        public void InitializeObject(object context)
        {
        }

        public object InitializeValue(CustomPropertyInfo customPropertyInfo, object context)
        {
            if (customPropertyInfo.Name == "Content")
            {
                // See remarks in ProvideValue method:
                // provide the values on which the saved properties will be restored upon
                RadDocking docking = context as RadDocking;
                List<PaneProxy> proxies = new List<PaneProxy>();
                foreach (RadPane pane in this.GetOrderedPanes(docking).ToArray())
                {
                    proxies.Add(new PaneProxy() { Content = pane.Content });
                }
                return proxies;
            }
            return null;
        }

        public object ProvideValue(CustomPropertyInfo customPropertyInfo, object context)
        {
            RadDocking docking = context as RadDocking;
            if (customPropertyInfo.Name == "Layout")
            {
                // let the RadDocking save the layout of the Panes:
                return this.SaveLayoutAsString(docking);
            }
            else if (customPropertyInfo.Name == "Content")
            {
                // create proxies for all of the Panes and save their content
                IEnumerable<RadPane> panes = this.GetOrderedPanes(docking);
                List<PaneProxy> proxies = new List<PaneProxy>();
                foreach (RadPane pane in panes)
                {
                    proxies.Add(new PaneProxy() { Content = pane.Content });
                }
                return proxies;
            }
            return null;
        }

        public void RestoreValue(CustomPropertyInfo customPropertyInfo, object context, object value)
        {
            if (customPropertyInfo.Name == "Layout")
            {
                // let the RadDocking load the layout of the RadPanes
                this.LoadLayoutFromString(value.ToString(), context as RadDocking);
            }
            else if (customPropertyInfo.Name == "Content")
            {
                // the PersistenceManager does not re-create UI elements - in this case the Content of the RadPane.
                // So, instead of providing a value on which the saved properties will be applied,
                // we will use the InitializeValue method.
            }
        }

        private string SaveLayoutAsString(RadDocking instance)
        {
            MemoryStream stream = new MemoryStream();
            instance.SaveLayout(stream);

            stream.Seek(0, SeekOrigin.Begin);

            StreamReader reader = new StreamReader(stream);
            return reader.ReadToEnd();
        }

        private void LoadLayoutFromString(string xml, RadDocking instance)
        {
            using (Stream stream = new MemoryStream(Encoding.UTF8.GetBytes(xml)))
            {
                stream.Seek(0, SeekOrigin.Begin);
                instance.LoadLayout(stream);
            }
        }

        private IEnumerable<RadPane> GetOrderedPanes(RadDocking docking)
        {
            // get the RadPanes always in the same order:
            RadPane[] array = docking.Panes.ToArray();
            Array.Sort(array, new RadPaneComparer());
            return array;
        }
    }

    public class RadPaneComparer : IComparer<RadPane>
    {
        int IComparer<RadPane>.Compare(RadPane x, RadPane y)
        {
            // compare RadPanes by their serialization tag:
            string xSerializationTag = RadDocking.GetSerializationTag(x);
            string ySerializationTag = RadDocking.GetSerializationTag(y);

            return xSerializationTag.CompareTo(ySerializationTag);
        }
    }

    //====================================================================================
    //
    //====================================================================================
    public class GridViewCustomPropertyProvider : ICustomPropertyProvider
    {
        public CustomPropertyInfo[] GetCustomProperties()
        {
            // Create three custom properties to persist the Columns, Sorting and Group descriptors using proxy objects
            return new CustomPropertyInfo[]
                {
                    new CustomPropertyInfo("Columns", typeof(List<ColumnProxy>)),
                    new CustomPropertyInfo("SortDescriptors", typeof(List<SortDescriptorProxy>)),
                    new CustomPropertyInfo("FilterDescriptors", typeof(List<FilterSetting>)),
                    new CustomPropertyInfo("GroupDescriptors", typeof(List<GroupDescriptorProxy>)),
                };
        }

        public void InitializeObject(object context)
        {
            if (context is RadGridView)
            {
                RadGridView gridView = context as RadGridView;
                gridView.SortDescriptors.Clear();
                gridView.GroupDescriptors.Clear();
                gridView.FilterDescriptors.Clear();
            }
        }

        public object InitializeValue(CustomPropertyInfo customPropertyInfo, object context)
        {
            return null;
        }

        public object ProvideValue(CustomPropertyInfo customPropertyInfo, object context)
        {
            RadGridView gridView = context as RadGridView;
            if (customPropertyInfo.Name == "Columns")
            {
                // create proxies for all of the columns and save only specific properties
                List<ColumnProxy> proxies = new List<ColumnProxy>();
                foreach (GridViewColumn column in gridView.Columns)
                {
                    proxies.Add(new ColumnProxy()
                    {
                        UniqueName = column.UniqueName,
                        Header = column.Header.ToString(),
                        DisplayOrder = column.DisplayIndex,
                        Width = column.Width,
                    });
                }
                return proxies;
            }
            else if (customPropertyInfo.Name == "SortDescriptors")
            {
                // create proxies for all of the sort descriptors and save only specific properties
                List<SortDescriptorProxy> proxies = new List<SortDescriptorProxy>();
                foreach (ColumnSortDescriptor descriptor in gridView.SortDescriptors)
                {
                    proxies.Add(new SortDescriptorProxy()
                    {
                        ColumnUniqueName = descriptor.Column.UniqueName,
                        SortDirection = descriptor.SortDirection,
                    });
                }
                return proxies;
            }
            else if (customPropertyInfo.Name == "GroupDescriptors")
            {
                // create proxies for all of the group descriptors and save only specific properties
                List<GroupDescriptorProxy> proxies = new List<GroupDescriptorProxy>();
                foreach (ColumnGroupDescriptor descriptor in gridView.GroupDescriptors)
                {
                    proxies.Add(new GroupDescriptorProxy()
                    {
                        ColumnUniqueName = descriptor.Column.UniqueName,
                        SortDirection = descriptor.SortDirection,
                    });
                }
                return proxies;
            }
            else if (customPropertyInfo.Name == "FilterDescriptors")
            {
                // create proxies for all of the filter descriptors and save only specific properties
                List<FilterSetting> proxies = new List<FilterSetting>();               
                foreach (IColumnFilterDescriptor cfd in gridView.FilterDescriptors.OfType<IColumnFilterDescriptor>())
                {
                    FilterSetting setting = new FilterSetting();

                    if (cfd.FieldFilter.Filter1.Value != Telerik.Windows.Data.FilterDescriptor.UnsetValue)
                    {
                        setting.Filter1 = new FilterDescriptorProxy();
                        setting.Filter1.Member = cfd.FieldFilter.Filter1.Member;
                        setting.Filter1.Operator = cfd.FieldFilter.Filter1.Operator;
                        setting.Filter1.Value = cfd.FieldFilter.Filter1.Value;
                    }

                    if (cfd.FieldFilter.Filter2.Value != Telerik.Windows.Data.FilterDescriptor.UnsetValue)
                    {
                        setting.Filter2 = new FilterDescriptorProxy();
                        setting.Filter2.Member = cfd.FieldFilter.Filter2.Member;
                        setting.Filter2.Operator = cfd.FieldFilter.Filter2.Operator;
                        setting.Filter2.Value = cfd.FieldFilter.Filter2.Value;
                    }
                    foreach (Telerik.Windows.Data.FilterDescriptor fd in cfd.DistinctFilter.FilterDescriptors.OfType<Telerik.Windows.Data.FilterDescriptor>())
                    {
                        if (fd.Value == Telerik.Windows.Data.FilterDescriptor.UnsetValue)
                        {
                            continue;
                        }

                        FilterDescriptorProxy fds = new FilterDescriptorProxy();
                        fds.Member = fd.Member;
                        fds.Operator = fd.Operator;
                        fds.Value = fd.Value;
                        setting.SelectedDistinctValues.Add(fds);
                    }

                    proxies.Add(setting);
                    setting.PropertyName = setting.PropertyName = cfd.Column.DataMemberBinding.Path.Path;
                }
                return proxies;
            }
            return null;
        }

        public void RestoreValue(CustomPropertyInfo customPropertyInfo, object context, object value)
        {
            RadGridView gridView = context as RadGridView;
            if (customPropertyInfo.Name == "Columns")
            {
                List<ColumnProxy> savedProxies = value as List<ColumnProxy>;

                // restore properties on the saved columns:
                foreach (ColumnProxy proxy in savedProxies)
                {
                    GridViewColumn column = this.GetColumnInstance(gridView, proxy.UniqueName);
                    if (column != null)
                    {
                        column.DisplayIndex = proxy.DisplayOrder;
                        column.Header = proxy.Header;
                        column.Width = proxy.Width;
                    }
                }
            }
            else if (customPropertyInfo.Name == "SortDescriptors")
            {
                gridView.SortDescriptors.Clear();
                List<SortDescriptorProxy> savedProxies = value as List<SortDescriptorProxy>;

                // restore properties on the saved sort descriptors:
                foreach (SortDescriptorProxy proxy in savedProxies)
                {
                    GridViewColumn column = this.GetColumnInstance(gridView, proxy.ColumnUniqueName);                   
                    gridView.SortDescriptors.Add(new ColumnSortDescriptor() { Column = column, SortDirection = proxy.SortDirection });
                }
            }
            else if (customPropertyInfo.Name == "GroupDescriptors")
            {
                gridView.GroupDescriptors.Clear();
                List<GroupDescriptorProxy> savedProxies = value as List<GroupDescriptorProxy>;

                // restore properties on the saved group descriptors:
                foreach (GroupDescriptorProxy proxy in savedProxies)
                {
                    GridViewColumn column = this.GetColumnInstance(gridView, proxy.ColumnUniqueName);
                    gridView.GroupDescriptors.Add(new ColumnGroupDescriptor() { Column = column, SortDirection = proxy.SortDirection });
                }
            }
            else if (customPropertyInfo.Name == "FilterDescriptors")
            {
                gridView.FilterDescriptors.Clear();
                List<FilterSetting> settings = value as List<FilterSetting>;
                foreach (FilterSetting setting in settings)
                {
                    FilterSetting currentSetting = setting;

                    GridViewDataColumn matchingColumn =
                    (from column in gridView.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 && setting.Filter1.Member != 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 && setting.Filter2.Member != null)
                        {
                            cfd.FieldFilter.Filter2.Member = setting.Filter2.Member;
                            cfd.FieldFilter.Filter2.Operator = setting.Filter2.Operator;
                            cfd.FieldFilter.Filter2.Value = setting.Filter2.Value;
                        }

                        foreach (FilterDescriptorProxy 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);
                        }
                        setting.PropertyName = cfd.Column.DataMemberBinding.Path.Path;

                        gridView.FilterDescriptors.Add(cfd);
                    }
                }
            }
        }

        private GridViewColumn GetColumnInstance(RadGridView gridView, string uniqueName)
        {
            foreach (GridViewColumn column in gridView.Columns)
            {
                if (column.UniqueName == uniqueName)
                    return column;
            }
            return null;
        }
    }

    public class ColumnProxy
    {
        public string UniqueName { get; set; }
        public int DisplayOrder { get; set; }
        public string Header { get; set; }
        public GridViewLength Width { get; set; }
    }

    public class SortDescriptorProxy
    {
        public string ColumnUniqueName { get; set; }
        public ListSortDirection SortDirection { get; set; }
    }

    public class GroupDescriptorProxy
    {
        public string ColumnUniqueName { get; set; }
        public ListSortDirection? SortDirection { get; set; }
    }

    public class FilterDescriptorProxy
    {
        public string Member { get; set; }
        public FilterOperator Operator { get; set; }
        public object Value { get; set; }
        public bool IsCaseSEnsitive { get; set; }
    }

    public class FilterSetting
    {
        public string PropertyName { get; set; }
        List<FilterDescriptorProxy> _SelectedDistinctValues;
        public List<FilterDescriptorProxy> SelectedDistinctValues
        {
            get
            {
                if (_SelectedDistinctValues == null)
                {
                    _SelectedDistinctValues = new List<FilterDescriptorProxy>();
                }
                return _SelectedDistinctValues;
            }
        }

        FilterDescriptorProxy _Filter1;
        public FilterDescriptorProxy Filter1
        {
            get
            {
                return _Filter1;
            }
            set
            {
                _Filter1 = value;
            }
        }

        FilterDescriptorProxy _Filter2;
        public FilterDescriptorProxy Filter2
        {
            get
            {
                return _Filter2;
            }
            set
            {
                _Filter2 = value;
            }
        }
    }

    //====================================================================================
    //
    //====================================================================================
    public class RichTextBoxCustomPropertyProvider : ICustomPropertyProvider
    {
        #region ICustomPropertyProvider Members
        public CustomPropertyInfo[] GetCustomProperties()
        {
            // Create two custom properties to serialize the RichTextBox properties and content
            return new CustomPropertyInfo[]
                {
                    new CustomPropertyInfo("Content", typeof(string)),
                    new CustomPropertyInfo("AcceptsReturn", typeof(bool)),
                };
        }

        public void InitializeObject(object context)
        {

        }

        public object InitializeValue(CustomPropertyInfo customPropertyInfo, object context)
        {
            return null;
        }

        public object ProvideValue(CustomPropertyInfo customPropertyInfo, object context)
        {
            RadRichTextBox owner = context as RadRichTextBox;
            if (customPropertyInfo.Name == "Content")
            {
                TxtFormatProvider provider = new TxtFormatProvider();
                string content = provider.Export(owner.Document);
                return content;
            }
            else
            {
                return this.GetValueSafely(customPropertyInfo.Name, owner);
            }
        }

        private object GetValueSafely(string propertyName, RadRichTextBox owner)
        {
            PropertyInfo info = owner.GetType().GetProperty(propertyName);
            if (info != null)
            {
                return info.GetValue(owner, null);
            }
            else
                throw new Exception();
        }

        private void SetValueSafely(string propertyName, object value, RadRichTextBox owner)
        {
            PropertyInfo info = owner.GetType().GetProperty(propertyName);
            if (info != null)
            {
                info.SetValue(owner, value, null);
            }
            else
                throw new Exception();
        }

        public void RestoreValue(CustomPropertyInfo customPropertyInfo, object context, object value)
        {
            RadRichTextBox owner = context as RadRichTextBox;
            if (customPropertyInfo.Name == "Content")
            {
                TxtFormatProvider provider = new TxtFormatProvider();
                owner.Document = provider.Import(value.ToString());
            }
            else
            {
                this.SetValueSafely(customPropertyInfo.Name, value, owner);
            }
        }

        #endregion
    }

    //====================================================================================
    //
    //====================================================================================
    public class PaneProxy
    {
        public object Content { get; set; }
    }
}

Alex Fidanov
Telerik team
 answered on 02 Apr 2012
1 answer
114 views
I noticed the panorama is available in the winforms collection and was wondering if you have plans or even an eta for adding this control to the wpf suite? Also do you have plans for any other nice controls that are metro like such as the popup menu bar, text buttons or text tabs?

I would also be available to beta test these as we are starting work on our next version and wish it to appear as a metro app even on win xp and 7.

Robert
Hristo
Telerik team
 answered on 02 Apr 2012
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
Book
FileDialogs
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
Rating
SplashScreen
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
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?