Telerik Forums
UI for WPF Forum
1 answer
187 views

I want to change the width of the label part of DataFormDataField. The correct place to edit should be the controls ControlTemplate:

<Grid.ColumnDefinitions>
  <ColumnDefinition Width="*"/><!-- Label -->
  <ColumnDefinition Width="2*"/><!-- Editor -->
  <ColumnDefinition Width="24"/><!-- ? Icon -->
</Grid.ColumnDefinitions>
 

 I want this to be something like: 

<Grid.ColumnDefinitions>
  <ColumnDefinition Width="{Binding LabelWidth}" /><!-- LabelWidth = Attached property? -->
  <ColumnDefinition Width="2*"/>
  <ColumnDefinition Width="24"/>
</Grid.ColumnDefinitions>

 

The width should not be a fix value in the ControlTemplate. It should be variable so different DataForms can have different label widths. Is that possible?

 

Johannes

 

 

Stefan
Telerik team
 answered on 18 Jun 2015
5 answers
404 views
I have several textboxes in my property grid that are sometimes larger than the grid, I don't want the grid to scroll horizontally. I added code in the loaded event to disable the scrollbar which works well. However when I click the category or A-Z button the scrollbar appears. I tried using the sorted and grouped method to disable the scrollbar but that doesn't seem to work. Any suggestions?
Yoan
Telerik team
 answered on 18 Jun 2015
1 answer
304 views

Hi all,

 I am using the RadRichTextBox to display a docx file in ReadOnly mode. 

By default, the RadRichTextBox shows a gray background behind the page. I would like to change this from gray to black, but I cannot figure out how. I would rather not include a theme from telerik in my assembly as this is the only visual change I need to make.

Just to be clear, I want to change the background behind the page, not the color of the page itself.

Thanks

Tanya
Telerik team
 answered on 18 Jun 2015
1 answer
121 views

After looking at the CRM demo I decided to implement a similar type of functionality where based on a bool state the grid would show either a few columns or all columns

      <telerik:RadGridView helpers:GridViewColumnHelper.HideNonImportantColumns="{Binding IsInOverviewState}"
                             ItemsSource="{Binding Contacts}" ColumnWidth="*"

I am using Prism, everything works fine if I set a Minimum Height and Width of the main Shell and set the WindowState to normal. However, if I start the application maximized without these settings, when the grid is loaded, although it shows the right number of columns the width of the grid is incorrect (too big), if I slightly adjust the size of the window everything sorts itself out. 

 This is the grid definition 

 <Grid.ColumnDefinitions>

            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="2*"/>
            <ColumnDefinition Width="2*"/>
        </Grid.ColumnDefinitions>

 if you see the attached files you will see what I mean.

Thanks for any help in advance. 


 

 

 

Dimitrina
Telerik team
 answered on 18 Jun 2015
3 answers
320 views

I have a GridView that has 3 columns.  However, the host Grid needs to be just the width of the 1st column.  I have bound the column's Width Property to my Model View as shown:

 

<telerik:GridViewDataColumn
    Header="Name"
    DataMemberBinding="{Binding Name}"
    Width="{Binding NameColumnWidth}"
    IsReadOnly="True" />

However, the Cell should resize only based on the content size so it is defined as SizeToCells:

 

private GridViewLength _nameColumnWidth =
    new GridViewLength(0, GridViewLengthUnitType.SizeToCells);
 
[Display(
    AutoGenerateField=false)]
[System.Xml.Serialization.XmlIgnore]
public GridViewLength NameColumnWidth
{
    get { return _nameColumnWidth; }
    set
    {
        if (_nameColumnWidth != value)
        {
            _nameColumnWidth = value;
            notifyPropertyChanged("NameColumnWidth");
        }
    }
}

How can I set the grid width to match the width of the name column's width?  Is there a converter that takes the AutoSize value from the column and converts it to Pixels?  Or, can I set the System.Windows.GridLength = NameColumnWidth?  Can I do this another way if I don't use SizeToCells?

Stefan
Telerik team
 answered on 17 Jun 2015
3 answers
245 views
Hello.

Here is code of my window:
<telerik:RadDocking x:Name="radDocking" PanesSource="{Binding Panes}">
        <telerik:RadDocking.Resources>
            <Style x:Key="RadPaneCustomStyle" TargetType="{x:Type telerik:RadPane}" BasedOn="{StaticResource RadPaneStyle}">
                <Setter Property="Header" Value="{Binding Header}" />
                <Setter Property="ToolTip" Value="{Binding ToolTip}" />
                <Setter Property="IsHidden" Value="{Binding IsHidden, Mode=TwoWay}" />
                <Setter Property="IsActive" Value="{Binding IsActive, Mode=TwoWay}" />
                <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
            </Style>
            <Style TargetType="{x:Type telerik:RadPane}" BasedOn="{StaticResource RadPaneCustomStyle}">
                <Setter Property="CanDockInDocumentHost" Value="True" />
            </Style>
            <Style TargetType="{x:Type telerik:RadDocumentPane}" BasedOn="{StaticResource RadPaneCustomStyle}">
                <Setter Property="CanDockInDocumentHost" Value="True" />
            </Style>
        </telerik:RadDocking.Resources>
 
        <telerik:RadDocking.DockingPanesFactory>
            <docking:CustomDockingPanesFactory />
        </telerik:RadDocking.DockingPanesFactory>
        <telerik:RadDocking.CurrentSaveLoadLayoutHelper>
            <docking:CustomSaveLoadLayoutHelper />
        </telerik:RadDocking.CurrentSaveLoadLayoutHelper>
 
        <telerik:RadSplitContainer InitialPosition="DockedLeft">
            <telerik:RadPaneGroup x:Name="leftGroup" telerik:RadDocking.SerializationTag="leftGroup" />
        </telerik:RadSplitContainer>
 
        <telerik:RadSplitContainer InitialPosition="DockedRight">
            <telerik:RadPaneGroup x:Name="rightGroup" telerik:RadDocking.SerializationTag="rightGroup" />
        </telerik:RadSplitContainer>
 
        <telerik:RadSplitContainer InitialPosition="DockedBottom">
            <telerik:RadPaneGroup x:Name="bottomGroup" telerik:RadDocking.SerializationTag="bottomGroup" />
        </telerik:RadSplitContainer>
    </telerik:RadDocking>

public void SaveLayout()
{
    var docking = DockingManager as RadDocking;
 
    using (var stream = File.Open(GetLayoutFilePath(State), FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
    {
        docking.SaveLayout(stream);
    }
}
 
public void LoadLayout(WorkspaceState state)
{
    var docking = DockingManager as RadDocking;
 
    using (var stream = File.Open(GetLayoutFilePath(State), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
    {
        docking.LoadLayout(stream);
    }
}

So, the problem is:
When i create some pads and save/load layout and dont hide or pin it it's ok. But when i pin it loose the style, so header become empty.
When i am hiding it and restoring, there is exseption:
System.InvalidOperationException was unhandled
  HResult=-2146233079
  Message=Cannot modify the logical children for this node at this time because a tree walk is in progress.
  Source=PresentationFramework
  StackTrace:
       at System.Windows.FrameworkElement.RemoveLogicalChild(Object child)
       at MS.Internal.Controls.InnerItemCollectionView.ClearModelParent(Object item)
       at MS.Internal.Controls.InnerItemCollectionView._RemoveAt(Int32 index, Int32 indexR, Object item)
       at MS.Internal.Controls.InnerItemCollectionView.Remove(Object item)
       at System.Windows.Controls.ItemCollection.Remove(Object removeItem)
       at Telerik.Windows.Controls.RadPaneGroup.CloseSinglePane(RadPane pane) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadPaneGroup.cs:line 1522
       at Telerik.Windows.Controls.RadPaneGroup.ClosePane(RadPane pane) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadPaneGroup.cs:line 653
       at Telerik.Windows.Controls.RadDocking.HidePane(RadPane pane) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadDocking.cs:line 430
       at Telerik.Windows.Controls.RadPane.Close() in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadPane.cs:line 1461
       at Telerik.Windows.Controls.RadPane.OnIsHiddenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadPane.cs:line 1226
       at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
       at System.Windows.StyleHelper.ApplyStyleOrTemplateValue(FrameworkObject fo, DependencyProperty dp)
       at System.Windows.StyleHelper.InvalidateContainerDependents(DependencyObject container, FrugalStructList`1& exclusionContainerDependents, FrugalStructList`1& oldContainerDependents, FrugalStructList`1& newContainerDependents)
       at System.Windows.StyleHelper.DoStyleInvalidations(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle)
       at System.Windows.StyleHelper.UpdateStyleCache(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle, Style& styleCache)
       at System.Windows.FrameworkElement.OnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
       at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
       at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
       at System.Windows.FrameworkElement.UpdateStyleProperty()
       at System.Windows.TreeWalkHelper.InvalidateStyleAndReferences(DependencyObject d, ResourcesChangeInfo info, Boolean containsTypeOfKey)
       at System.Windows.TreeWalkHelper.OnResourcesChanged(DependencyObject d, ResourcesChangeInfo info, Boolean raiseResourceChangedEvent)
       at System.Windows.FrameworkElement.OnAncestorChangedInternal(TreeChangeInfo parentTreeState)
       at System.Windows.TreeWalkHelper.OnAncestorChanged(DependencyObject d, TreeChangeInfo info, Boolean visitedViaVisualTree)
       at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
       at MS.Internal.PrePostDescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
       at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe, Boolean visitedViaVisualTree)
       at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
       at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
       at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
       at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
       at System.Windows.DescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
       at MS.Internal.PrePostDescendentsWalker`1._VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
       at System.Windows.DescendentsWalker`1.VisitNode(FrameworkElement fe, Boolean visitedViaVisualTree)
       at System.Windows.DescendentsWalker`1.VisitNode(DependencyObject d, Boolean visitedViaVisualTree)
       at System.Windows.DescendentsWalker`1.WalkLogicalChildren(FrameworkElement feParent, FrameworkContentElement fceParent, IEnumerator logicalChildren)
       at System.Windows.DescendentsWalker`1.WalkFrameworkElementLogicalThenVisualChildren(FrameworkElement feParent, Boolean hasLogicalChildren)
       at System.Windows.DescendentsWalker`1.IterateChildren(DependencyObject d)
       at System.Windows.DescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode)
       at MS.Internal.PrePostDescendentsWalker`1.StartWalk(DependencyObject startNode, Boolean skipStartNode)
       at System.Windows.TreeWalkHelper.InvalidateOnTreeChange(FrameworkElement fe, FrameworkContentElement fce, DependencyObject parent, Boolean isAddOperation)
       at System.Windows.FrameworkElement.ChangeLogicalParent(DependencyObject newParent)
       at System.Windows.FrameworkElement.AddLogicalChild(Object child)
       at System.Windows.LogicalTreeHelper.AddLogicalChild(FrameworkElement parentFE, FrameworkContentElement parentFCE, Object child)
       at MS.Internal.Controls.InnerItemCollectionView.SetModelParent(Object item)
       at MS.Internal.Controls.InnerItemCollectionView.Add(Object item)
       at System.Windows.Controls.ItemCollection.Add(Object newItem)
       at Telerik.Windows.Controls.RadDocking.AddSplitContainer(RadSplitContainer radSplitContainer) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadDocking.cs:line 309
       at Telerik.Windows.Controls.Docking.DockingLayoutFactory.LoadDocking(XmlReader reader) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\DockingLayoutFactory.cs:line 236
       at Telerik.Windows.Controls.RadDocking.LoadLayout(Stream source, Boolean raiseEventsIfNoSerializationTag) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadDocking.Layout.cs:line 77
       at Telerik.Windows.Controls.RadDocking.LoadLayout(Stream source) in c:\TB\105\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadDocking.Layout.cs:line 58
       at GameEd.IDE.Services.WorkspaceService.LoadLayout(WorkspaceState state) in d:\TFS\GameEd-Telerik\IDE\GameEd.IDE\Services\WorkspaceService.Layout.cs:line 107
       at GameEd.IDE.Services.WorkspaceService.LoadLayout() in d:\TFS\GameEd-Telerik\IDE\GameEd.IDE\Services\WorkspaceService.Layout.cs:line 96
       at Catel.MVVM.Command`2.Execute(TExecuteParameter parameter, Boolean ignoreCanExecuteCheck)
       at Catel.MVVM.Command`2.Execute(TExecuteParameter parameter)
       at Catel.MVVM.Command`2.Execute(Object parameter)
       at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
       at System.Windows.Controls.MenuItem.InvokeClickAfterRender(Object arg)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.Run()
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at GameEd.App.Main() in d:\TFS\GameEd-Telerik\GameEd\obj\Debug\obj\Debug\decoratedxaml\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

If i remove IsHidden binding it's work perfectly.
Michele
Top achievements
Rank 2
 answered on 17 Jun 2015
4 answers
149 views

I have stumbled upon an issue where I only want the user to be able to edit the lower half of a matrix (It is a matrix that is symmetrical across the diagonal). I am creating a datatable based on a 2d array. 

 the grid is defined like this:

<telerik:RadGridView x:Name="matrixView" ItemsSource="{Binding MatrixTable}"
                             CanUserDeleteRows="False" CanUserInsertRows="False"
                             CanUserReorderColumns="False" CanUserSortColumns="False"
                             ShowGroupPanel="False"
                             GridLinesVisibility="Both"
                             SelectionUnit="Cell"
                             Width="AUto" Height="Auto">
</telerik:RadGridView>

And then I have the following viewmodel:

 

public class MatrixViewModel
    {
        public DataTable MatrixTable { get; set; }
 
        public MatrixViewModel(double[,] matrix)
        {
            this.MatrixTable = BuildTable(matrix);
        }
 
        private DataTable BuildTable(double[,] matrix)
        {
            var table = new DataTable();
 
            table.Columns.Add("Name", typeof(string));
            for (int col = 0; col < matrix.GetLength(0); col++)
            {
                table.Columns.Add(col.ToString(), typeof(double));
            }
 
            for (int i = 0; i < matrix.GetLength(0); i++)
            {
                var row = table.NewRow();
                row[0] = i.ToString();
 
                for (int j = 0; j <= i; j++)
                {
                    row[j + 1] = matrix[i, j];
                }
                table.Rows.Add(row);
            }
            return table;
        }
    }

NullvalueToBoolean is defined as follows:

[ValueConversion(typeof(object), typeof(Boolean))]
    public class NullValueToBoolean : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value == null;
        }
 
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

And finally the codebehind:

public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = new MatrixViewModel(new double[,]{
                {1,0,0},
                {0.25,1,0},
                {0.25,0.75,1}
            });
            this.matrixView.AutoGeneratingColumn += matrixView_AutoGeneratingColumn;
        }
 
        void matrixView_AutoGeneratingColumn(object sender, GridViewAutoGeneratingColumnEventArgs e)
        {
            var column = (GridViewDataColumn)e.Column;
            column.IsFilterable = false;
 
            if (column.DataType == typeof(double?))
            {
                column.IsReadOnlyBinding = new Binding(column.DataMemberBinding.Path.Path)
                {
                    Converter = new NullValueToBoolean()
                };
            }
            else
            {
                column.IsReadOnly = true;
            }
        }
    }

 The code produces the following output when I try to edit one of the cells that are not readonly:
System.Windows.Data Error: 40 : BindingExpression path error: '0' property not found on 'object' ''DataRow' (HashCode=9659819)'. BindingExpression:Path=0; DataItem='DataRow' (HashCode=9659819); target element is 'TextBox' (Name=''); target property is 'Text' (type 'String')

However, if I remove the code that sets the ReadOnlyBinding, editing works fine. Do you have a suggestion on how to fix/avoid this issue? Maybe there is a better way to solve this problem with the Telerik UI for WPF?

Stefan
Telerik team
 answered on 17 Jun 2015
10 answers
103 views

 Hallo,



i m trying reload my diagram. Saving is going well but if i m try load data from xml string shapes are loaded correctly but there are no connections between shapes. I m using ObservableGraphSourceBase<GraphNode,Link> as graph source and it inherit ISerializableGraphSource interface. During the debug i ve found out that method DeserializeLink is never call. Could you be so kind and give some advice how to figure it out.



Thank you very much.

Best regards 

Jakub



ps: here my serialization class

 

001.public partial class KnihyXmlGraphSource : ISerializableGraphSource
002.    {
003.        private List<GraphNode> SerializedNodes = new List<GraphNode>();
004.        public void SerializeNode(object model, SerializationInfo info)
005.        {
006.            GraphNode node = model as GraphNode;
007.             
008.            string pom = node.ToString();
009.            info["Content"] = node.Content;
010.            info["ShapeType"] = node.ToString();
011.            info["Id"] = node.GetID();
012.             
013.        }
014. 
015.        public void SerializeLink(ILink link, SerializationInfo info)
016.        {
017.            var myLink = link as Link;
018.            if (myLink.Source != null)
019.            {
020.                info["Source"] = myLink.Source.GetID();
021.            }
022.            if (myLink.Target != null)
023.            {
024.                info["Target"] = myLink.Target.GetID();
025.            }
026.            if (myLink.Type != null)
027.            {
028.                info["Type"] = myLink.Type;
029.            }
030.        }
031.         
032.        public ILink DeserializeLink(IConnection connection, SerializationInfo info)
033.        {
034.            Link link = new Link();
035.            string sourceID = string.Empty;
036.            string targetID = string.Empty;
037. 
038. 
039.            if (info["Target"] != null)
040.            {
041.                targetID = info["Target"].ToString();
042.            }
043.            if (info["Source"] != null)
044.            {
045.                sourceID = info["Source"].ToString();
046.            }
047.            if (info["Type"] != null)
048.            {
049.                switch (info["Type"].ToString())
050.                {
051.                    case Constants.Type1:
052.                        link.Type = LinkType.Typ1;
053.                        break;
054.                    case Constants.Type2:
055.                        link.Type = LinkType.Typ2;
056.                        break;
057.                    default:
058.                        link.Type = LinkType.Typ3;
059.                        break;
060.                }
061.            }
062.            GraphNode source = SerializedNodes.FirstOrDefault(x => x.GetID().Equals(sourceID));
063.            if (source != null)
064.            {
065.                link.Source = source;
066.            }
067. 
068.            GraphNode target = SerializedNodes.FirstOrDefault(x => x.GetID().Equals(targetID));
069.            if (target != null)
070.            {
071.                link.Target = target;
072.            }
073. 
074.            if (info["Type"] != null)
075.            {
076.                string type = info["Source"].ToString();
077.                switch (type)
078.                {
079.                    case Constants.Type1:
080.                        link.Type = LinkType.Typ1;
081.                        break;
082.                    case Constants.Type2:
083.                        link.Type = LinkType.Typ2;
084.                        break;
085.                    case Constants.Type3:
086.                        link.Type = LinkType.Typ3;
087.                        break;
088.                    default:
089.                        break;
090.                }
091.            }
092.            return link;
093.        }
094. 
095.        public object DeserializeNode(IShape shape, SerializationInfo info)
096.        {
097.            GraphNode node = new GraphNode();
098. 
099.            string pom = string.Empty;
100.            if (info["ShapeType"] != null)
101.            {
102.                pom = (info["ShapeType"].ToString());
103.                pom = pom.Substring(23);
104.                switch (pom)
105.                {
106.                    case Constants.DescriptionNode:
107.                        node = new DescriptionNode();
108.                        node.shape = MindmapItem.ShapeTypes.Description;
109.                        break;
110.                    case Constants.AuthorNode:
111.                        node = new AuthorNode();
112.                        node.shape = MindmapItem.ShapeTypes.Author;
113.                        break;
114.                    case Constants.GenreNode:
115.                        node = new GenreNode();
116.                        node.shape = MindmapItem.ShapeTypes.Genre;
117.                        break;
118.                    case Constants.BookDescriptionNode:
119.                        node = new BookDescriptionNode();
120.                        node.shape = MindmapItem.ShapeTypes.BookDescription;
121.                        break;
122.                    default:
123.                        break;
124.                }
125.            }
126. 
127.            if (info["Position"] != null)
128.            {
129.                node.Position = Utils.ToPoint(info["Position"].ToString()).Value;
130.            }
131. 
132.            if (info["Content"] != null)
133.            {
134.                node.Content = info["Content"].ToString();
135.            }
136. 
137. 
138.            SerializedNodes.Add(node);
139.            return node;
140.        }
141.    }

Peshito
Telerik team
 answered on 17 Jun 2015
1 answer
61 views

Hello,

this dialog should have a fixed size for the column width selector: as it doesn't have one, the width of the dialog changes when we change the size.

The same happens when we change the value in any of the up/down that are in the dialog.

This is not a very good user experience.

Evgenia
Telerik team
 answered on 17 Jun 2015
3 answers
122 views

I have a an MVVM app where a page has a gridview bound to an entitiyframeworkdatasource.  The data loads as soon as the page loads and takes a while... so it blocks the UI thread.  Is there a way to prevent this?  I tried using another thread but couldn't get it to work right.

 

Also, how would I go about saving and undoing changes?  I created a button to save where I just call SaveChanges on the context.. and that works... But if I revert all changed entities in the context, the grid doesn't update the rows.

Stefan
Telerik team
 answered on 16 Jun 2015
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?