Telerik Forums
UI for WPF Forum
1 answer
56 views

Hello,



We are using the RichTextBox to display emails and the emails coming from one of the servers shows the embedded image as 10 x 10 pixels.  If I take the temporary image that was downloaded (and linked to the ImageInline) and send it in another email or open it with an image viewer, it shows up with the proper dimensions.



Thanks,

Wil

Wil
Top achievements
Rank 1
 answered on 15 Jan 2014
1 answer
139 views
Hi,

my need is to store and restore Filter settings.
The scenario - a grid with Names is in a dialog.
The user (for an example) chooses "Joe" in the Firstname Column and "Doe" in the FamilyName column.

Prior closing the Dialog I store the FilterDescriptors like this:
//pFilterDescriptors is the FilterDescriptors collection from RadGridView
//_FilterStore is a local CompositeFilterDescriptorCollection
public void StoreFilter(Telerik.Windows.Data.CompositeFilterDescriptorCollection pFilterDescriptors) {
    if(_FilterStore != null) {
        _FilterStore.Clear();
        foreach(IFilterDescriptor o in pFilterDescriptors) {
            _FilterStore.Add(o);
        }
    }
}

The next time I open the dialog I restore these stored Values like this:
//pFilterDescriptors is the FilterDescriptors collection from RadGridView
//_FilterStore is a local CompositeFilterDescriptorCollection
public void RestoreFilter(Telerik.Windows.Data.CompositeFilterDescriptorCollection pFilterDescriptors) {
    if(pFilterDescriptors != null) {
        pFilterDescriptors.Clear();
        foreach(IFilterDescriptor o in _FilterStore) {
            pFilterDescriptors.Add(o);
        }
    }
}

This works - but when I open the filter box only "Joe" can be found in the distinct values.
"Clear Filter" on the column is also not working since the column nows nothing about filtering.

What I need (expected) is:
   a.) Highlighted Filter Symbols in the filtered columns
   b.) Filtered Values available in the Filter Selector (also those not visible at the moment)

Or in simple Words - the RadGridView should look / work like it did when I closed the dialog.

Manfred
ManniAT
Top achievements
Rank 2
 answered on 15 Jan 2014
1 answer
155 views
Hello,

We have implemented custom insert logic in our grids via the context menu.
However, when there are no items in the grid, the user can't use the context menu so we show the "Click here to insert new row".

Once there's an item in the collection, the "Click here to insert new row" is no longer shown.

We are having problems pinpointing the best location at which to handle this.

We check if the grid doesn't have any items and if the "CanUserInsertRows" property is set to true.
If these conditions both are true, we show the insert new row area, otherwise we hide it:

public void HandleNewRowPosition()
{
    var showNewRow = !GridTreeListHasItems() && Grid.CanUserInsertRows;
    Grid.NewRowPosition = GetInsertNewRowPosition(showNewRow);
}
 
private bool GridTreeListHasItems()
{
    var anyValue = false;
    var x = Grid.ItemsSource as IEnumerable;
    if (x != null)
    {
        anyValue = x.GetEnumerator().MoveNext();
    }
 
    return anyValue;
}
 
private GridViewNewRowPosition GetInsertNewRowPosition(bool show)
{
    var converter = new BooleanToGridViewNewRowPositionConverter();
 
    return (GridViewNewRowPosition)converter.Convert(show, typeof(GridViewNewRowPosition), null, CultureInfo.CurrentUICulture);
}
 
 /// <summary>
/// Converts a boolean to the position of new rows. True corresponds with the top.
/// </summary>
[ValueConversion(typeof(bool), typeof(GridViewNewRowPosition))]
public class BooleanToGridViewNewRowPositionConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        return (bool) value ? GridViewNewRowPosition.Top : GridViewNewRowPosition.None;
    }
 
    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        return (GridViewNewRowPosition) value == GridViewNewRowPosition.Top;
    }
}


I tried adding a value changed callback to the "CanUserInsertRows" dependency property, but it doesn't seem to trigger the callback when I do a Notify property changed on the property which is bound to the "CanUserInsertRows" property of the grid:

_canUserInserRowsPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(GridViewDataControl.CanUserInsertRowsProperty, typeof(GridViewDataControl));
 
if (_canUserInserRowsPropertyDescriptor != null)
{
    _canUserInserRowsPropertyDescriptor.AddValueChanged(this.AssociatedObject, CanUserInserRowsChanged_Handler);
}
 
private void CanUserInserRowsChanged_Handler(object sender, EventArgs e)
{
    HandleNewRowPosition();
}

We used to call the "HandleNewRowPosition" method at several places (eg "OnItemsChanged", "OnLoaded", ...) but we noticed that it got called way to many times when we only expected it once, maybe twice.

Anyone have an idea on how to do this properly?

Hristo
Telerik team
 answered on 15 Jan 2014
3 answers
474 views
The save load layout example is not mvvm. The example uses code behind to call the SaveLayout and LoadLayout on the docking control and it does not use a view model. Where is an example of radDocking save and load layout using no code behind. ?
Vladi
Telerik team
 answered on 15 Jan 2014
1 answer
170 views
I would like to have connections styled depending on the nodes they are connecting.

For example, I have node types A, B.  All connections from A -> A, A -> B, B -> A will be ConnectionStyle1.  All connections for B -> B will be ConnectionStyle2.

I am currently using the MVVM implementation of DiagramGraphSouce and it is working very well.  I am also using StyleSelector for both Connection and Shape.

Attempting this from within the ConnectionStyleSelector does not work as the item.Target is always null (the connection has not been established with the Target yet).

Clearly the easy solution is for ConnectionStyleSelector to be called both BEFORE and AFTER the link is established, allowing me to detect Source and Target are of type B and return the necessary style.  No such luck.

I tried from within DiagramGraphSource.AddLink() which is called after the connection is established.  There are SourceCapType and TargetCapType properties that would fulfill my styling requirement.  Unfortunately, setting these properties does nothing.

Finally I tried using ConnectionManipulationCompleted() where I am able to manipulate the connection ends.  Alas, there is no way to retrieve the VM of the nodes involved in the Source and Target of the connection, so there is no way to tell what node types I'm actually connecting.  

I thought of actually creating a VM for my connections (not just the nodes), but that seems like a lot of effort for something that sounds like it should be very easy to accomplish.

Am I missing something?

Thanks,
Mike
Pavel R. Pavlov
Telerik team
 answered on 15 Jan 2014
3 answers
259 views
Is there any way to change the scroll speed on the RadGridView? Currently one scroll moves 3 rows, we need it to just move 1 row, as our rows are quite big.

thanks.
Yoan
Telerik team
 answered on 15 Jan 2014
1 answer
97 views
Hi,

I have a WeekViewDefinition and when I try to change the GroupHeaderDateStringFormat property in code behind the change doesn't take effect immediatly. The control need an AppointmentsSource before my change can take effect, is this normal???

ie:
                this.ScheduleView.AppointmentsSource = null;
                this.ScheduleView.AppointmentsSource = mSpots;

Thank's
Alain
Kalin
Telerik team
 answered on 15 Jan 2014
2 answers
352 views
Hello,

I am using the newest WPF Controls Examples - Print and Export with RadDocument as a template for my project.

I need to print in US Legal (8.5 x 11) paper size, in landscape orientation and a smaller font using the WPF RadGridView as a source.

I have tried adding the following to the example code to change orientation and page size:
RadDocument.SectionDefaultPageOrientation = PageOrientation.Landscape;
and
RadRichTextBox.Document.SectionDefaultPageOrientation = PageOrientation.Landscape; 
and
Section.PageSize = new Size() { Height = 11.0, Width = 8.5 };
and it does not work.

Also, I have a large amount of text/columns to include in the print so I need to lower my font size to get everything to fit.

I have tried adding the following code to the example to change the printed font size:
RadRichTextBox.FontSize = 5.0; 
and it does not work.

Any help would be most appreciated!

John


Petya
Telerik team
 answered on 15 Jan 2014
7 answers
164 views
We have a telerik RadGrid View . Inside the Radgridview data template I have another Rad Grid view which is bidning to a propertey on View Model.

<telerik:RadGridView>
 <telerik:RadGridView.RowStyle><!-Style-> <telerik:RadGridView.RowStyle>
 <telerik:RadGridView.AlternateRowStyle><!-Style-> <telerik:RadGridView.AlternateRowStyle>
 <telerik:RadGridView.RowDetailsTemplate >
    <telerik:RadGridView  ItemsSource="{Binding DataContext.VMPOPERTEY, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" 
                                    AutoGenerateColumns="True"
                                    Name="myGrids" ColumnWidth="Auto" IsReadOnly="True" >
 </telerik:RadGridView.RowDetailsTemplate >
</telerik:RadGridView>


Now the problem is when ever I am expanding an Item , the VMPOPERTEY get set as per the currently expanded item . So the Duplicate values get reflected in all the child elements.

For Example in following figure , when I select Row1 , the row 1 value gets update but the moment I select Row two too (as it expansion mode is multiple) bot Row1 and Row 2 shows the value for Row 2 as this is the last slected row.

Dimitrina
Telerik team
 answered on 15 Jan 2014
1 answer
99 views
Hi Telerik,

In my application I am using telerik:GridViewImageColumn.
My scenario is I am assigning collection to gridview each object row contains the byte array of image. Collection contains more than 1000 rows.  Actually collection is for my company product users. We have few products (say 10).
I am showing those product user details in gridview with product image. Each user row contains product image byte array.
After assigning data source when I scroll the gridview sometimes getting exception “Target invocation exception”

Exception type: TargetInvocationException

Source: mscorlib

-----
-----
------

======== InnerException ========

        Description: The value should not null.

Parametername: uriSource

        Exception type: ArgumentNullException

        Source: PresentationCore

        Stack Trace:

 System.Windows.Media.Imaging.BitmapImage..ctor(Uri uriSource, RequestCachePolicy uriCachePolicy)

    Telerik.Windows.Controls.GridViewImageColumn.image_ImageFailed(Object sender, 
ExceptionRoutedEventArgs e)


My xaml code for assigning data member is

<telerik:GridViewImageColumn Header=""  UniqueName="colProductImage" DataMemberBinding="{Binding ProductImage}" ImageHeight="20" ImageWidth="20" /> 

What could be the solution for above problem?

My idea is to avoid above problem, instead of loading image byte data for each row just loads all 10 products data in one collection and give the reference to image column with collection index. If it is possible  please tell how to do .

Thanks for help. Naresh Mesineni

Dimitrina
Telerik team
 answered on 15 Jan 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?