or
I have created a RadPanelBar with two items. I want the DefaultItem to be selected by default. How can I do that dynamically?
Below is the xaml code for RadPanelBar
<telerik:RadPanelBar x:Name="mybar" Width="252" Height="500" HorizontalAlignment="Left" VerticalAlignment="Top" ExpandMode="Single" Margin="0,58,0,0" SelectedItem="{Binding PanelBarItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> <telerik:RadPanelBarItem x:Name="DefaultItem" > <telerik:RadPanelBarItem.Header> <TextBlock Text="Default Item" /> </telerik:RadPanelBarItem.Header> </telerik:RadPanelBarItem> <telerik:RadPanelBarItem x:Name="ExpandItem" > <telerik:RadPanelBarItem.Header> <TextBlock Text="Expand Item" /> </telerik:RadPanelBarItem.Header> <ListBox Height="200" Margin="1,17,1,143" ItemsSource="{Binding TList}" BorderBrush="Transparent" BorderThickness="0" SelectedItem="{Binding SelectedTool, Mode=TwoWay}" > </ListBox> </telerik:RadPanelBarItem> </telerik:RadPanelBar>
I also want the first item in the TList to be selected by default when ExpandItem is selected. Please help with this.
Thanks in Advance
<telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Attributes.[PERCEELID]}" Header="PerceelId" DataType="{x:Type sys:Int32}" /> First step, make ik a GridViewExpressionColumn :<telerik:GridViewExpressionColumn UniqueName="Opp" Header="Oppervlakte (ha)" Expression="Attributes["PERCEELID"]" />So far so good, this still displays the same result as my original column (nothing calculated so far).
But as soon as I want to do something with this value, nothing is shown and I receive errors in the output window.
This is about the simplest expression I can think of (multiplying by 2) :
<telerik:GridViewExpressionColumn UniqueName="Opp" Header="Oppervlakte (ha)" Expression="Attributes["PERCEELID"] * 2" />The column stays empty and the outpunt window shows :
A first chance exception of type 'System.ArgumentException' occurred in System.ComponentModel.DataAnnotations.dll
A first chance exception of type 'System.InvalidOperationException' occurred in System.Core.dll
I have tried to explicitely cast my value first before multiplying (Convert.ToInt32(Attributes["PERCEELID"]) * 2); but no success.
If I do the same in code-behind, there is no problem :
Expression<Func<Graphic, double>> expression = g => (int)g.Attributes["PERCEELID"] * 2; var c = this.GevondenPercelenDataGrid.Columns["Opp"] as GridViewExpressionColumn; c.Expression = expression;
The ToString() of this expression yields:
"g => Convert((Convert(g.Attributes.get_Item(\"PERCEELID\")) * 2))"
Using this string as value for "Expression" in the xaml is no solution either.
Can anyone give me some tips on building expressions in xaml ?
Kind regards,
Martin