I have this scenario:
<
telerik:RadRibbonWindow
...
WindowStartupLocation
=
"CenterScreen"
Title
=
"Xxxxx"
Height
=
"700"
Width
=
"980"
MinHeight
=
"700"
MinWidth
=
"980"
Name
=
"XxxxxWindow"
AutomationProperties.Name
=
"XxxxxWindow"
Closing
=
"XxxxxWindow_Closing"
>
<
i:Interaction.Triggers
>
<
i:EventTrigger
EventName
=
"Closed"
>
<
c:CommandAction
Command
=
"{Binding Path=ShellClosedCommand}"
SyncOwnerIsEnabled
=
"True"
/>
</
i:EventTrigger
>
</
i:Interaction.Triggers
>
<
DockPanel
SizeChanged
=
"mainRegion_SizeChanged"
Name
=
"mainRegionDockPanel"
AutomationProperties.Name
=
"mainRegionDockPanel"
>
<
telerik:RadRibbonBar
DockPanel.Dock
=
"Top"
prism:RegionManager.RegionName
=
"{x:Static common:RegionNames.RibbonBarRegion}"
ApplicationName
=
"{Binding Title}"
HorizontalContentAlignment
=
"Stretch"
HelpButtonVisibility
=
"Visible"
HelpRequested
=
"RadRibbonBar_HelpRequested"
Name
=
"RibbonTitle"
AutomationProperties.Name
=
"RibbonTitle"
ApplicationButtonImageSource
=
"{Binding Source={x:Static CommonProps:Resources.Icon_Mario}, Converter={StaticResource bitmapConverter}}"
>
<
telerik:RadRibbonBar.ApplicationMenu
>
<
telerik:ApplicationMenu
RightPaneVisibility
=
"Collapsed"
>
<
telerik:RadRibbonButton
Text
=
"Select/Change Xxxxx/Xxxxx"
Click
=
"Xxxxx_Click"
/>
<
telerik:RadRibbonButton
Text
=
"Close"
Click
=
"CloseApplication"
/>
</
telerik:ApplicationMenu
>
</
telerik:RadRibbonBar.ApplicationMenu
>
<
telerik:RadRibbonBar.QuickAccessToolBar
>
<
telerik:QuickAccessToolBar
>
<
telerik:RadRibbonButton
Text
=
"Export"
Size
=
"Small"
Command
=
"{Binding ExportToExcelCommand}"
IsEnabled
=
"{Binding ExportToExcelEnabled, UpdateSourceTrigger=PropertyChanged}"
SmallImage
=
"{Binding Source={x:Static CommonProps:Resources.Icon16_Excel}, Converter={StaticResource bitmapConverter}}"
/>
<
telerik:RadRibbonButton
Text
=
"Print"
Size
=
"Small"
Command
=
"{Binding PrintCommand}"
IsEnabled
=
"{Binding PrintSearchEnabled, UpdateSourceTrigger=PropertyChanged}"
SmallImage
=
"{Binding Source={x:Static CommonProps:Resources.Icon16_Print}, Converter={StaticResource bitmapConverter}}"
/>
</
telerik:QuickAccessToolBar
>
</
telerik:RadRibbonBar.QuickAccessToolBar
>
</
telerik:RadRibbonBar
>
This is what i get after a couple hours, tha bad thing about this is that the quicklaunch and the minimize, close, etc buttons
dissapears, any idea why?
<
Style
TargetType
=
"DockPanel"
x:Name
=
"mainRegionDockPanel"
>
<
Setter
Property
=
"Background"
Value
=
"{DynamicResource titleBackground}"
/>
</
Style
>
<
LinearGradientBrush
x:Key
=
"titleBackground"
EndPoint
=
"0.5,1"
StartPoint
=
"0.5,0"
>
<
GradientStop
Color
=
"#FFE1EBF5"
Offset
=
"0.396"
/>
<
GradientStop
Color
=
"#FFE1EBF5"
Offset
=
"1"
/>
<
GradientStop
Color
=
"#FFC6DFFC"
Offset
=
"0.463"
/>
<
GradientStop
Color
=
"#FFE1EBF5"
/>
<
GradientStop
Color
=
"#FFD8E7F7"
Offset
=
"0.856"
/>
</
LinearGradientBrush
>
List<RequestData> produceList =
new
List<RequestData>();
produceList.Add(
new
RequestData(
"2"
, 132, DateTime.Today,
"Cash Grants"
));
produceList.Add(
new
RequestData(
"1"
, 145, DateTime.Today.AddYears(1),
"Cash Grants"
));
produceList.Add(
new
RequestData(
"3"
, 149, DateTime.Today.AddYears(1).AddDays(1),
"Cash Grants"
));
produceList.Add(
new
RequestData(
"4"
, 187, DateTime.Today,
"Cash Grants"
));
produceList.Add(
new
RequestData(
"5"
, 186, DateTime.Today.AddYears(1),
"Matching Gifts"
));
produceList.Add(
new
RequestData(
"6"
, 131, DateTime.Today,
"Dinners & Events"
));
produceList.Add(
new
RequestData(
"7"
, 173, DateTime.Today.AddYears(1),
"Dinners & Events"
));
produceList.Add(
new
RequestData(
"8"
, 172, DateTime.Today,
"Matching Gifts"
));
produceList.Add(
new
RequestData(
"9"
, 140, DateTime.Today.AddYears(1),
"Cash Grants"
));
produceList.Add(
new
RequestData(
"10"
, 129, DateTime.Today,
"Dinners & Events"
));
produceList.Add(
new
RequestData(
"11"
, 158, DateTime.Today,
"Matching Gifts"
));
produceList.Add(
new
RequestData(
"12"
, 164, DateTime.Today.AddYears(1).AddDays(1),
"Dinners & Events"
));
SeriesMapping seriesMapping =
new
SeriesMapping();
seriesMapping.SeriesDefinition =
new
HorizontalBarSeriesDefinition();
seriesMapping.GroupingSettings.GroupDescriptors.Add(
new
ChartGroupDescriptor(
"Type"
));
seriesMapping.GroupingSettings.GroupDescriptors.Add(
new
ChartYearGroupDescriptor(
"RequestDate"
));
seriesMapping.ItemMappings.Add(
new
ItemMapping(
"RequestAmount"
, DataPointMember.YValue, ChartAggregateFunction.Sum));
seriesMapping.ItemMappings.Add(
new
ItemMapping(
"RequestDate"
, DataPointMember.XCategory));
radChart.SeriesMappings.Add(seriesMapping);
radChart.ItemsSource = produceList;
radChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat =
"yyyy"
;
List<RequestData> produceList =
new
List<RequestData>();
produceList.Add(
new
RequestData(
"2"
, 132, DateTime.Today,
"Cash Grants"
));
produceList.Add(
new
RequestData(
"1"
, 145, DateTime.Today.AddYears(1),
"Cash Grants"
));
produceList.Add(
new
RequestData(
"3"
, 149, DateTime.Today.AddYears(1).AddDays(1),
"Cash Grants"
));
produceList.Add(
new
RequestData(
"12"
, 164, DateTime.Today.AddYears(1).AddDays(1),
"Dinners & Events"
));
produceList.Add(
new
RequestData(
"4"
, 187, DateTime.Today,
"Cash Grants"
));
produceList.Add(
new
RequestData(
"5"
, 186, DateTime.Today.AddYears(1),
"Matching Gifts"
));
produceList.Add(
new
RequestData(
"6"
, 131, DateTime.Today,
"Dinners & Events"
));
produceList.Add(
new
RequestData(
"7"
, 173, DateTime.Today.AddYears(1),
"Dinners & Events"
));
produceList.Add(
new
RequestData(
"8"
, 172, DateTime.Today,
"Matching Gifts"
));
produceList.Add(
new
RequestData(
"9"
, 140, DateTime.Today.AddYears(1),
"Cash Grants"
));
produceList.Add(
new
RequestData(
"10"
, 129, DateTime.Today,
"Dinners & Events"
));
produceList.Add(
new
RequestData(
"11"
, 158, DateTime.Today,
"Matching Gifts"
));
SeriesMapping seriesMapping =
new
SeriesMapping();
seriesMapping.SeriesDefinition =
new
HorizontalBarSeriesDefinition();
seriesMapping.GroupingSettings.GroupDescriptors.Add(
new
ChartGroupDescriptor(
"Type"
));
seriesMapping.GroupingSettings.GroupDescriptors.Add(
new
ChartYearGroupDescriptor(
"RequestDate"
));
seriesMapping.ItemMappings.Add(
new
ItemMapping(
"RequestAmount"
, DataPointMember.YValue, ChartAggregateFunction.Sum));
seriesMapping.ItemMappings.Add(
new
ItemMapping(
"RequestDate"
, DataPointMember.XCategory));
radChart.SeriesMappings.Add(seriesMapping);
radChart.ItemsSource = produceList;
radChart.DefaultView.ChartArea.AxisX.DefaultLabelFormat =
"yyyy"
;
I stumbled upon a adding a content to the DropDownContent property of the RadDropDownButton. Particularly I have a problem binding a dependency property of the content element to a property up the logical tree hierarchy. I managed to reproduce the issue in small piece of XAML. It contains a window with a local value “Test” set to its Tag property. There is a TextBlock inside the DropDown button with its property Text bound to the Tag property of the window. When I run the sample I get the following error:
“System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Window', AncestorLevel='1''. BindingExpression:Path=Tag; DataItem=null; target element is 'TextBlock' (Name=''); target property is 'Text' (type 'String')”
Another identical TextBlock is placed outside of the DropDown button and its Binding works fine.
I guess that the RadDropDownButton control fails to preserve the logical tree inheritance by not calling
<Window x:Class="WpfApplication14.MainWindow" Title="MainWindow" SizeToContent="WidthAndHeight" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" |
Tag="Test" > |
<Grid Width="200" Height="200"> |
<StackPanel HorizontalAlignment="Left"> |
<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=Tag}" Height="22"/> |
<telerik:RadDropDownButton Content="Drop Down" Height="22" Width="200" DropDownWidth="200"> |
<telerik:RadDropDownButton.DropDownContent> |
<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=Tag}"/> |
</telerik:RadDropDownButton.DropDownContent> |
</telerik:RadDropDownButton> |
</StackPanel> |
</Grid> |
</Window> |