Telerik Forums
UI for WPF Forum
3 answers
155 views

Hello,

I have a problem with the tileview control.

I have a tileview in my page with RadFluidContentControl to have different view depends on the size :

<telerik:RadTileView IsItemsAnimationEnabled="False">
    <telerik:RadTileViewItem>
        <telerik:RadFluidContentControl
            TransitionDuration="0"
            State="Large"
            SmallToNormalThreshold="400 400"
            NormalToSmallThreshold="400 400"
            NormalToLargeThreshold="600 600"
            LargeToNormalThreshold="600 600">
            <telerik:RadFluidContentControl.SmallContent>
                <StackPanel x:Name="SmallContent">
                    <TextBlock Text="Small"/>
                    <TextBlock Text="{Binding MyList.Count}"/>
                    <ListBox ItemsSource="{Binding MyList, Mode=TwoWay}"/>
                </StackPanel>
            </telerik:RadFluidContentControl.SmallContent>
            <telerik:RadFluidContentControl.Content>
                <StackPanel x:Name="Content">
                    <TextBlock Text="Normal"/>
                    <TextBlock Text="{Binding MyList.Count}"/>
                    <ListBox ItemsSource="{Binding MyList, Mode=TwoWay}"/>
                </StackPanel>
            </telerik:RadFluidContentControl.Content>
            <telerik:RadFluidContentControl.LargeContent>
                <StackPanel x:Name="LargeContent">
                    <TextBlock Text="Large"/>
                    <TextBlock Text="{Binding MyList.Count}"/>
                    <ListBox ItemsSource="{Binding MyList, Mode=TwoWay}"/>
                </StackPanel>
            </telerik:RadFluidContentControl.LargeContent>
        </telerik:RadFluidContentControl>
    </telerik:RadTileViewItem>
</telerik:RadTileView>
In this sample this is the same content for Small, Normal and Large Content. It displays the number of item in a list and the content of the list.

MyList is just a List of String with 2 elements.

When I ran the application, only the listbox in the normal content displayed the 2 elements. In the small and large content the list was empty.

But in all contents (small, normal and large) the textblock displayed the correct number of elements in my list (2).

Do I something wrong ?

Thanks in advance for your answer.

Regards,

Patrick

Zarko
Telerik team
 answered on 21 Mar 2012
5 answers
252 views
Hi,

I ran into the problem that I need to get access to the type of a property bound to a column. I need to acomplish this on the AutoGeneratingColumn event.


I've manage to do it with a common grid:

private void dtgRestuls_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
        {
               var columnAttributes = ((PropertyDescriptor)e.PropertyDescriptor).Attributes.OfType<ColumnAttribute>();
               
if (columnAttributes.Count() == 0)
                {
                    e.Cancel = true;
                }
                else
                {
                    e.Cancel = !IsColumnMarkAsVisible(columnAttributes);
                }
            }

            
        }

The problem is that DataGridAutoGeneratingColumnEventArgs exposes a PropertyDescriptor property, but GridViewAutoGeneratingColumnEventArgs don't.


Anyone got any idea of where to find it on GridViewAutoGeneratingColumnEventArgs, or maybe a workaround?

Thanks!
Andreas
Top achievements
Rank 1
 answered on 21 Mar 2012
2 answers
156 views
Hello,  I've been tinkering with using the RadControls for WPF in my projects and am generally pleased with the toolkit.  The hotfix situation is perplexing me though.

I noticed it pulls down updates automatically, and that the Telerik references in my project are pointing to one of various folders under, for example, C:\Users\James\AppData\Roaming\Telerik\Updates\RadControls_for_WPF40_2011_2_0920_Dev_hotfix\ ...

I like that it keeps my working project up-to-date with the latest builids.  But this is making it difficult for me to set up a clean build environment.

If I want to mark my code as a certain "release", for example, and check everything into version control (I'm now using Mercurial), I like to include the 3rd-party libraries along with it. So that it can always be reproduced exactly as built.  Normally I try to have all 3rd-party libraries within a subfolder in my development folder (which is C:\Apps), as for example:  C:\Apps\VendorLibs\Telerik
That way, it is obvious where to add references from, and the version-control/build commands know where to get their stuff. Also, this makes it straightforward to set up a continuous-build facility on a separate box to detect checkins, run the build, run the unit-tests, and poke me as soon as I break something.  Or, to create a virtual-machine (I'm using VMWare) of a fresh Windows environment, to test an installer on.  Also, I develop on two boxes at the same time. With the C:\Apps folder synced between them (using a program similar to DropBox). This would work a lot better if Telerik's libraries were within that folder, instead of elsewhere on a totally different path.

So, my question is: Is there a way to configure the hotfix facility of Telerik's tools, such that instead of using those hotfix folders down in \Users\James\AppData\Roaming, which change periodically, to instead have them placed automatically within a single stable folder of my choosing?
Petar
Telerik team
 answered on 21 Mar 2012
10 answers
145 views
Hi,

i cant copy the content from the footers into the clipboard. The footer row is always empty in clipboard!

ClipboardCopyMode is "All"

My Style:

<Style x:Key="DataFooter" TargetType="GridView:GridViewFooterCell">
        <Setter Property="Content">
            <Setter.Value>
                <StackPanel>
                    <GridView:AggregateResultsList ItemsSource="{Binding}" VerticalAlignment="Center">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                    <TextBlock VerticalAlignment="Center" Text="{Binding Caption}" />
                                    <TextBlock VerticalAlignment="Center" Text="{Binding FormattedValue}" />
                                </StackPanel>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Vertical" />
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                    </GridView:AggregateResultsList>
                </StackPanel>
            </Setter.Value>
        </Setter>
    </Style>

Regards,
Thomas


Thomas
Top achievements
Rank 1
 answered on 21 Mar 2012
1 answer
150 views
Hi,

I have three classes Employee, EmployeeCollection and Address

I have set the datacontext to a EmployeeCollection this works ok until I get to the Address Field then i only get one textbox. I have tried to create a DataTemplate for Address but  it doesn't seem to use the template I have created. 

Thanks 

David

public class Address
    {
        String _Street;
        String _City;
        String _Town;
        String _County;
        String _PostCode;
 
        public String Street
        {
            get
            {
                return this._Street;
            }
            set
            {
                this._Street = value;
                NotifyPropertyChanged(() => Street);
            }
        }
        public String City
        {
            get
            {
                return this._City;
            }
            set
            {
                this._City = value;
                NotifyPropertyChanged(() => City);
            }
        }
        public String Town
        {
            get
            {
                return this._Town;
            }
            set
            {
                this._Town = value;
                NotifyPropertyChanged(() => Town);
            }
        }
        public String County
        {
            get
            {
                return this._County;
            }
            set
            {
                this._County = value;
                NotifyPropertyChanged(() => County);
            }
        }
        public String PostCode
        {
            get
            {
                return this._PostCode;
            }
            set
            {
                this._PostCode = value;
                NotifyPropertyChanged(() => PostCode);
            }
        }
 
        public Address()
        {
        }
 
        public Address(String street, String city, String town, String county, String postCode)
        {
            this.Street = street;
            this.City = city;
            this.Town = town;
            this.County = county;
            this.PostCode = postCode;
        }
 
        #region PropertyNotify
 
         
        [field: NonSerializedAttribute()]
        public event PropertyChangedEventHandler PropertyChanged = delegate { };
 
        public readonly Action<Action> _synchronousInvoker;
 
        public Address(Action<Action> synchronousInvoker)
        {
            _synchronousInvoker = synchronousInvoker;
        }
 
        public void NotifyPropertyChanged<T>(Expression<Func<T>> expr)
        {
            var body = expr.Body as MemberExpression;
            if (body != null)
            {
                try
                {
                    if (_synchronousInvoker != null)
                        _synchronousInvoker(() => InvokePropertyChanged(expr));
                    else
                        InvokePropertyChanged(expr);
                }
                catch (Exception Ex)
                {
                    if (Ex.Message == "Invoke or BeginInvoke cannot be called on a control until the window handle has been created.")
                    {
                        InvokePropertyChanged(expr);
                    }
                }
            }
        }
 
        private void InvokePropertyChanged<T>(Expression<Func<T>> expr)
        {
            var body = expr.Body as MemberExpression;
            if (body != null)
            {
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(body.Member.Name));
                }
            }
        }
 
        #endregion
    }
 
 public class Employee : INotifyPropertyChanged
    {
        Int32 _EmployeeID;
        String _FirstName;
        String _SurName;
        Location _DefaultStore;
        float _Sallary;
        float _HourlyRate;
        EmployeeType _EmployeeType;
        Address _Address;
 
        public Int32 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                _EmployeeID = value;
                NotifyPropertyChanged(() => EmployeeID);
            }
        }
        public String FirstName
        {
            get
            {
                return this._FirstName;
            }
            set
            {
                this._FirstName = value;
                NotifyPropertyChanged(() => FirstName);
            }
        }
        public String SurName
        {
            get
            {
                return this._SurName;
            }
            set
            {
                this._SurName = value;
                NotifyPropertyChanged(() => SurName);
            }
        }
        public Location DefaultStore
        {
            get
            {
                return this._DefaultStore;
            }
            set
            {
                this._DefaultStore = value;
                NotifyPropertyChanged(() => DefaultStore);
            }
        }
        public float Sallary
        {
            get
            {
                return this._Sallary;
            }
            set
            {
                this._Sallary = value;
                NotifyPropertyChanged(() => Sallary);
            }
        }
        public float HourlyRate
        {
            get
            {
                return this._HourlyRate;
            }
            set
            {
                this._HourlyRate = value;
                NotifyPropertyChanged(() => HourlyRate);
            }
        }
        public EmployeeType EmployeeType
        {
            get
            {
                return this._EmployeeType;
            }
            set
            {
                this._EmployeeType = value;
                NotifyPropertyChanged(() => EmployeeType);
            }
        }
        public Address Address
        {
            get
            {
                return _Address;
            }
            set
            {
                _Address = value;
                NotifyPropertyChanged(() => Address);
            }
        }
 
        public Employee()
        {
        }
 
        public Employee(Int32 employeeID, String firstName, String surName, Location defaultStore, float sallary, float hourlyRate, EmployeeType employeeType, Address address)
        {
            this._EmployeeID = employeeID;
            this._FirstName = firstName;
            this._SurName = surName;
            this._DefaultStore = defaultStore;
            this._Sallary = sallary;
            this._HourlyRate = hourlyRate;
            this._EmployeeType = employeeType;
            this._Address = address;
        }
 
        #region PropertyNotify
 
        [field: NonSerializedAttribute()]
        public event PropertyChangedEventHandler PropertyChanged = delegate { };
 
        public readonly Action<Action> _synchronousInvoker;
 
        public Employee(Action<Action> synchronousInvoker)
        {
            _synchronousInvoker = synchronousInvoker;
        }
 
        public void NotifyPropertyChanged<T>(Expression<Func<T>> expr)
        {
            var body = expr.Body as MemberExpression;
            if (body != null)
            {
                try
                {
                    if (_synchronousInvoker != null)
                        _synchronousInvoker(() => InvokePropertyChanged(expr));
                    else
                        InvokePropertyChanged(expr);
                }
                catch (Exception Ex)
                {
                    if (Ex.Message == "Invoke or BeginInvoke cannot be called on a control until the window handle has been created.")
                    {
                        InvokePropertyChanged(expr);
                    }
                }
            }
        }
 
        private void InvokePropertyChanged<T>(Expression<Func<T>> expr)
        {
            var body = expr.Body as MemberExpression;
            if (body != null)
            {
                if (PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs(body.Member.Name));
                }
            }
        }
 
        #endregion
    }
 
    public class EmployeeCollection : ObservableCollection<Employee>
    {
        public EmployeeCollection()
        {
        }
    }
Maya
Telerik team
 answered on 21 Mar 2012
3 answers
81 views
Hello,

I am using Telerik version 2011.2. In a lot of areas in the application I am writing I am using the RadGridView.
I would like to know if there is a way to have a "second header" above the regular headers.

Basically, I would like to be able to do something akin to the center and merge functions in excel, having the individual headers above the cells and another set of headers which can span more then one column above those.

I have a sample (352KB .jpg) but it will not upload.
Any ideas on how to accomplish this would be appreciated.
Thank you,

Eli
Vlad
Telerik team
 answered on 21 Mar 2012
5 answers
307 views
While using RedGate ANTS Performance Profiler, I get to a point in my application where I click on a RadButton.  Through the event handlers that subsequently get fired, I eventually get the following error:

System.Windows.Markup.XamlParseException: The type initializer for 'Telerik.Windows.Controls.RichTextBoxUI.RadRichTextBoxRibbonUI' threw an exception. ---> System.Security.VerificationException: Operation could destabilize the runtime.

This only occurs when I'm running the profiler and so far, only in this one place.  The view that it's trying to initialize doesn't explicitly use the RadRichTextBoxRibbonUI.  It only uses RadWrapPanels and a RadComboBox.

Seeing how this doesn't happen during normal execution, it's hard to identify a cause within my implementation.  Also, not knowing the intrinsic behavior of how the performance profiler sets stuff up, I don't know what the difference would be.  

Any thoughts?

Stack Trace:
************** Exception Text **************
System.Windows.Markup.XamlParseException: The type initializer for 'Telerik.Windows.Controls.RichTextBoxUI.RadRichTextBoxRibbonUI' threw an exception. ---> System.Security.VerificationException: Operation could destabilize the runtime.
   at Telerik.Windows.Controls.RichTextBoxUI.RadRichTextBoxRibbonUI..cctor() in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Documents\RichTextBoxUI\RichTextBoxUI\RadRichTextBoxRibbonUI.cs:line 32
   --- End of inner exception stack trace ---
   at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
   at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
   at Xm8.UI.EWD2.MacroItemView.InitializeComponent() in c:\sd\Trunk\xm8\Asm\UI\EWD2\MacroItemView.xaml:line 1
   at Xm8.UI.EWD2.MacroItemView..ctor() in c:\sd\Trunk\xm8\Asm\UI\EWD2\MacroItemView.xaml.cs:line 34
   at Xm8.UI.EWD2.MacroDialog..ctor() in c:\sd\Trunk\xm8\Asm\UI\EWD2\MacroDialog.cs:line 100
   at Xm8.UI.EWD2.MacroSLView.ShowMacroDialog(IXm8State xm8State, String oldMacroCode, MacroDoc macroDoc, EDPL edpl, MacroOperation macroOperation) in c:\sd\Trunk\xm8\Asm\UI\EWD2\MacroSLView.xaml.cs:line 50
   at Xm8.EWD2.MP.Model.Macro.MacroSLModel.DoShowMacroDialog(MacroDoc macroDoc) in c:\sd\Trunk\xm8\Asm\MP\EWD2.MP\Model\Macro\MacroSLModel.cs:line 382
   at Xm8.EWD2.MP.Model.Macro.MacroSLModel.OnAdd() in c:\sd\Trunk\xm8\Asm\MP\EWD2.MP\Model\Macro\MacroSLModel.cs:line 351
   at Core.Sys.RelayCommand.Execute(Object parameter) in c:\sd\Trunk\core\Asm\Sys\Sys\RelayCommand.cs:line 67
   at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at Telerik.Windows.Controls.RadButton.OnClick() in c:\TB\117\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\Buttons\RadButton.cs:line 388
[truncated]
Boby
Telerik team
 answered on 20 Mar 2012
1 answer
82 views
Hi

If I add page numbers into the header or footer, they show the correct page number for each page (as you'd expect).

If you then protect the document, they will all show the same page number.  And one of them usually shows some selection highlighting on it too.  Even if I set the permissions for the page number to Everyone... same problem!

Any fix or workaround for this?
Boby
Telerik team
 answered on 20 Mar 2012
1 answer
154 views
How does one get the GridView to detect property validation attribute violations when they are specified in a buddy class?  For example, the property attributes in the buddy class below are not respected by the GridView.  I.e., the grid doesn't indicate a validation error for and it permits entry of a part number that doesn't match the regex. By contrast, the GridView does respect the IValidatableObject.Validate method.  I've tried making the PartMetadata class public; but it still didn't validate.

Any ideas?  thanks!

[MetadataType(typeof(Part.PartMetadata))]
public partial class Part : IValidatableObject {
 
    private sealed class PartMetadata {
        [RegularExpression(@"[0-9A-F]{4,20}")] // Not respected by the RadGridView 
        public string PartNumber { get; set; }
    }
 
    public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) {
        if (PartNumber == DrawingNumber) { 
            yield return new ValidationResult("part number = drawing number", new string[] { "PartNumber", "DrawingNumber" });
        }
    }
}


Nedyalko Nikolov
Telerik team
 answered on 20 Mar 2012
1 answer
104 views
Hi,

I have a gridview, and its itemsSource is bound to an ObservableCollection in the ViewModel, and the isBusy property is also bound to a property there. Initially the collection is empty. In the constructor of the ViewModel I initiate a new thread which does the data collection from the DB. When the thread starts, it sets the isBusy property to true and triggers a notification, so the grid displays the loading animation. When the data is collected, the grid is notified again, and it displays the data. At the beginning the query which collected the data ran for 10+ seconds, and everything worked fine. But the query was optimized, so now it runs for less then a second, and here comes my problem: at startup for some reason I have no data displayed in the grid. The pager displays correct data, everything is fine except there is nothing in the grid. If I go to the second page, the data appears, and from that point everything works fine again.

I guess that my problem is related with the worker thread I create and the PropertyChanged notification, but I have no idea how to make it work. One more detail: if I put a Thread.Sleep(1000) before the PropertyChanged notification, everything works as expected. But this is not a nice way to solve the problem.

Any ideas how to make it work?

Thanks,

Andras

Pavel Pavlov
Telerik team
 answered on 20 Mar 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?