Telerik Forums
UI for WPF Forum
4 answers
532 views
I have ObservableCollections that are bound to RadGridView and RadtreeListView controls to fill out the contents. I am using the IsSelected binding to process various operations on the ObservableCollections depending on what rows are selected.

Here is how the binding for IsSelected is defined in my XAML:

<em:StatusRowStyleSelector x:Key="StatusRowStyleDefinition">
    <em:StatusRowStyleSelector.StatusRowStyle>
        <Style TargetType="telerik:GridViewRow">
            <Setter Property="Background" Value="{StaticResource NormalBorderBrush}" />
            <Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}"/>
            <Setter Property="IsExpanded" Value="{Binding Path=IsExpanded, Mode=TwoWay}"/>
        </Style>
    </em:StatusRowStyleSelector.StatusRowStyle>
</em:StatusRowStyleSelector>

And here is how the style is applied as an attribute in both the RadGridView and RadtreeListView tag definitions:

RowStyleSelector="{DynamicResource StatusRowStyleDefinition}"
SelectionMode="Extended"
SelectionUnit="FullRow"

The problem:

If I have a view where some of the rows are not visible and I select all of the items (ctrl-A), only those items that are visible get the IsSelected property updated in the source objects.  If I scroll the hidden rows into view, the IsSelected property for the bound objects in the ObservableCollection finally gets updated as each row is scrolled into view.  So, apparently, "selecting all" selects all of the rows in the control, but the IsSelected property in the bound source objects in the ObservableCollection is updated only for visible rows.

The same happens if all rows are selected and I click on single row which deselects everything else: only the visible rows get the IsSelected property updated to false.

It works this way regardless of the state of the data virtualization. I'm scratching my head over this. Am I setting up the binding wrong or is this a bug?

Nick
Telerik team
 answered on 10 Jun 2013
1 answer
56 views
Hi,

When will RadControls for WPF Q2'13 be released and will be available for download?

Thanks
Regards
Tsafrir
Vlad
Telerik team
 answered on 10 Jun 2013
1 answer
281 views
After reviewing the documentation, specifically http://www.telerik.com/help/silverlight/radchartview-styles-and-templates-customizing-scatter-points.html, I am exploring ways to scale a custom scatter point based on values of the underlying data.

I know there is an old post in this forum relating to bubble plots in RadChartView (where the bubble is sized based on the underlying data) which is not currently supported.  This was 2012.

 
Looking at the source code for the Candlestick object (as part of the Candlestick series) as a reference, clearly the Candlestick uses sizing (scale) information to determine how big it should be based on the underlying data object.  In particular, it uses the layout and size information in the LayoutSlot to draw itself accordingly which is exactly what I need to do.  So, clearly the Candlestick has the mechanisms to do this internally (and in fact, it would be very nice if the classes were not declared Internal so they could easily be inherited and the issue would be easily solved for me just using a custom Candlestick object to draw what I want.

The scatter point template doesn't seem to get that information (the layout height and width is 0, only the X, Y coordinates are valid).

What I'm trying to do here is to write a custom point template which, using the load event on the template, can get scale information.  I do this in code-behind instead of defining the template in XAML so bear with me.  The template simply is a grid object with a handler attached to its loaded event, which causes the handler to be called whenever the chart renders the custom point template the first time the series is rendered.  In the loaded event of the grid, we simply create content based on the underlying data point.  This is very similar to the concept in the documentation where color and shape is changed.  What I want to do however is SIZE the object based on the underlying data.  Sizing is trivial, however, the sizing should match the current scale of the chart so the dimensions match the axis data, so I need a way to scale the axis information to the pixel.   ChartView does provide a conversion API (http://www.telerik.com/help/silverlight/radchartview-features-conversion.html) but I haven't found a good way to hook that in.  


What I have to date is this:

public static DataTemplate CreatePointTemplate(
         [NotNull]RoutedEventHandler pointLoadedHandler,
         string selectedBooleanField = null,
         string notSelectedBooleanField = null
         )
     {
  
         var template = new DataTemplate();
         var gridFactory = new FrameworkElementFactory(typeof(Grid));
            gridFactory.AddHandler(Control.LoadedEvent, pointLoadedHandler);
            
         template.VisualTree = gridFactory;
  
         return template;
  
     }

The handler code is:

private void HandlePointCreated(object sender, RoutedEventArgs e)
       {
           var grid = (Grid)sender;
           var scatterDataPoint = (ScatterDataPoint)((FrameworkElement)sender).DataContext;
           var data = (HistoricalMarketDataPoint)scatterDataPoint.DataItem;
 
           var layoutSlot = scatterDataPoint.LayoutSlot;
           var bubble = new Ellipse();
           var scale = !Equals(layoutSlot.Height, 0.0) ? data.PriceAverage/layoutSlot.Height : 1.0;
           var scaleSize = new Size(scale*layoutSlot.Width, scale*layoutSlot.Height);
 
           bubble.Width = scaleSize.Width;
           bubble.Height = scaleSize.Height;
            
           var chartPointBrush = new SolidColorBrush(Colors.Red);
           bubble.Fill = chartPointBrush;
           grid.Children.Add(bubble);
 
       }

The layout slot width and height are always 0 for a scatter point so I can't derive the scale from the layout box.   This is not true of the Candlestick object where it uses the layout information to size itself.

My custom point will be rendered at the X and Y locations correctly on the chart, what I'm missing is the ratio of pixel/value for the chart to allow me to compute the scale of the object so it matches the axes.   

For simplicity, I'm using linear axes on both X and Y.

So what I'd like to do is to compute the scale value in the handler code above.   I can easily get a reference to the chart object in the handler if needed, but I have no idea where to fish the plot scale data from right now.

Alternatively, I can use a CandlestickSeries instead of a ScatterSeries and accomplish the same thing but changing the rendering of the candlestick so what I need to make it do.  I haven't found of a way to do that via templates as the relevant overrides are all marked "internal".

Thanks!

E.


EM
Top achievements
Rank 1
 answered on 07 Jun 2013
2 answers
88 views
Not all of the items in SortDescriptors of my GridView are of type  ColumnSortDescriptor . Some are of type SortDescriptor, which has no Column property. It appears that these columns are the ones that  I specified SortingState . Only the columns where I specified sorting through the UI get ColumnSortDescriptor 
I'm trying use Persistence for my grid. How can I tell what column the sort descriptors is for when It is just a SortDescriptor and not a ColumnSortDescriptor?


David
Top achievements
Rank 1
 answered on 07 Jun 2013
3 answers
160 views
How to set the expand direction of the WPF radcontextmenu to UP, so that when I click on expand, the submenuitem popup expands right and upwards.
Rosen Vladimirov
Telerik team
 answered on 07 Jun 2013
0 answers
194 views

Hello,
For instance I have got 5 columns and I am going to show data (price) where each price(column) depends from different Currency.
I should get these currencies and prices from database and show them with correct cultures.
I don't know anything about currencies and prices, there could be anything. So I want to display price correctly for each currency.

I think that each column must have own culture, I should bind this cultures dynamically, and columns need to show prices correctly.

Is it possible?
Could you suggest me anything, best practices, working example, please?

Important: I don't want to have any code-behind and any static data in xaml. I implemented MVVM pattern.
Thank You


Sergiy
Top achievements
Rank 1
 asked on 07 Jun 2013
1 answer
165 views
Hi,

I am creating GridViewComboBoxColumn dynamically in code behind and want to bind ToolTip of the cells in this column to some property as below

var colLabor = new GridViewComboBoxColumn();
var tTemp = new DataTemplate() { DataType = typeof(Labor) };
 
FrameworkElementFactory factoryTextBlock = new FrameworkElementFactory(typeof(TextBox)) { Name = "factoryTextBlock" };
//factoryTextBlock.SetBinding(TextBlock.TextProperty, new Binding("ResourceTypeId"));
factoryTextBlock.SetValue(TextBox.TextProperty, "OK BYE");
factoryTextBlock.SetValue(TextBox.FontSizeProperty, 10.0d);
factoryTextBlock.SetValue(TextBox.WidthProperty, 100.0d);
tTemp.VisualTree = factoryTextBlock;
colLabor.ToolTipTemplate = tTemp;

But couldn't get it working.

But if I do its equivalent (I believe so) in XAML as described here, it works. Unfortunately the column is created on runtime so I can't go with XAML option.

Any ideas/suggestions?

Arpit

Ivan Ivanov
Telerik team
 answered on 07 Jun 2013
1 answer
102 views

Hi telerik support

I have a changing observable list of dates on my viewmodel, and I would like to highlight the days within that collection.

I have tried to implement my own DataTemplateSelector for the dayTemplateselector and I have managed to get the dates from my CollectionViewSource, but it seems that it only works on static data and the changes made to my collection does not appear in the Calendar.

How can I archive binding between the daytemplateSelector and my observableCollection?

Ivo
Telerik team
 answered on 07 Jun 2013
1 answer
104 views
Hi,
In a normal data-binding columns/cells, how can I add a suffix text in superscript? Something like:

abcd <sup>R</sup>

where abcd is from data source and R is an addon superscript.

Thanks!
Ivan Ivanov
Telerik team
 answered on 07 Jun 2013
1 answer
273 views
Hi,

i use a DataForm with lots of DataFormCheckBoxFields. Now i want to Enable or Disable some of these fields if
one of theme is checked?

If this is checked:
<telerik:DataFormCheckBoxField Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" Label="FIRMA:" Foreground="Black" HorizontalAlignment="Left" x:Name="FirmaConf"                                                                           VerticalContentAlignment="Center" VerticalAlignment="Center" DataMemberBinding="{Binding Firma,Mode=TwoWay}"  />

this should be enabled
         <telerik:DataFormCheckBoxField Grid.Row="1" Grid.Column="0" Label="zeigen:" Foreground="Black" HorizontalAlignment="Left" x:Name="FirmazeigenConf"                                                                            VerticalContentAlignment="Center" VerticalAlignment="Center" DataMemberBinding="{Binding FIRzeigen,Mode=TwoWay}"
IsEnabled="{Binding ElementName=FirmaConf, Path=DataMemberBinding, Mode=TwoWay}"/>

But how will i do this?
thanks
Regards
rene

 

Ivan Ivanov
Telerik team
 answered on 07 Jun 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?