This question is locked. New answers and comments are not allowed.
Hi there,
I have a RadModalWindow control inside a grid in my phone page. The window is to open in response to a templated listbox's selectedchange event.
It seems that I cannot force the radmodal windows datacontext to the listbox's current item. I am not sure if this has to do with the radmodal window or with a typical silverlight control in general so please forgive my mistake if any.
What should I set to the DataContext of the Actions RadModalWindow in order to bind it to the Selected Item of the styled listbox?
I have a RadModalWindow control inside a grid in my phone page. The window is to open in response to a templated listbox's selectedchange event.
It seems that I cannot force the radmodal windows datacontext to the listbox's current item. I am not sure if this has to do with the radmodal window or with a typical silverlight control in general so please forgive my mistake if any.
What should I set to the DataContext of the Actions RadModalWindow in order to bind it to the Selected Item of the styled listbox?
<
phone:PhoneApplicationPage
xmlns:telerikPrimitives
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"
x:Class
=
"ESMIS360.ESAgendaTasksPage"
xmlns:phone
=
"clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell
=
"clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:controls
=
"clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
xmlns:local
=
"clr-namespace:ESMIS360"
mc:Ignorable
=
"d"
d:DesignWidth
=
"480"
d:DesignHeight
=
"768"
FontFamily
=
"{StaticResource PhoneFontFamilyNormal}"
FontSize
=
"{StaticResource PhoneFontSizeNormal}"
Foreground
=
"{StaticResource PhoneForegroundBrush}"
Name
=
"ESAgenda"
SupportedOrientations
=
"PortraitOrLandscape"
Orientation
=
"Portrait"
shell:SystemTray.IsVisible
=
"True"
>
<
phone:PhoneApplicationPage.Resources
>
<
local:ValueToVisibilityConverter
x:Key
=
"ValueToVisibilityConverter"
/>
<
Style
x:Key
=
"CtxButton"
TargetType
=
"Button"
>
<
Setter
Property
=
"Width"
Value
=
"200"
/>
<
Setter
Property
=
"FontSize"
Value
=
"{StaticResource PhoneFontSizeSmall}"
/>
</
Style
>
<
DataTemplate
x:Name
=
"MyTasks"
x:Key
=
"TodayTasks"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"10"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
Image
Grid.Column
=
"0"
Grid.RowSpan
=
"2"
Source
=
"{Binding ImageLogo}"
VerticalAlignment
=
"Top"
/>
<
TextBlock
Grid.Column
=
"2"
Grid.Row
=
"0"
Text
=
"{Binding Start}"
Style
=
"{StaticResource PhoneTextLargeStyle}"
/>
<
TextBlock
Grid.Column
=
"2"
Grid.Row
=
"1"
TextWrapping
=
"Wrap"
Text
=
"{Binding Subject}"
Style
=
"{StaticResource PhoneTextAccentStyle}"
VerticalAlignment
=
"Top"
></
TextBlock
>
</
Grid
>
</
DataTemplate
>
<
Style
x:Key
=
"PhotoVieweritemStyle"
TargetType
=
"controls:PivotItem"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"controls:PivotItem"
>
<
ListBox
Name
=
"TaskList"
ItemsSource
=
"{Binding}"
ItemTemplate
=
"{StaticResource TodayTasks}"
SelectionChanged
=
"OnSelChange"
>
</
ListBox
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
phone:PhoneApplicationPage.Resources
>
<!--LayoutRoot is the root grid where all page content is placed-->
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"Transparent"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"*"
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
local:ESProgressBar
Grid.Row
=
"0"
x:Name
=
"ESBar"
ShowProgress
=
"False"
></
local:ESProgressBar
>
<
telerikPrimitives:RadModalWindow
Name
=
"Actions"
PlacementTarget
=
"{Binding ElementName=LayoutRoot}"
Placement
=
"CenterCenter"
>
<
Border
BorderBrush
=
"{StaticResource PhoneBorderBrush}"
BorderThickness
=
"{StaticResource PhoneBorderThickness}"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
/>
<
RowDefinition
Height
=
"10"
/>
<
RowDefinition
/>
<
RowDefinition
/>
<
RowDefinition
/>
<
RowDefinition
/>
<
RowDefinition
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
TextBlock
Grid.Row
=
"0"
Text
=
"{Binding Start}"
Style
=
"{StaticResource PhoneTextLargeStyle}"
/>
<
TextBlock
Grid.Row
=
"1"
TextWrapping
=
"Wrap"
Text
=
"{Binding Subject}"
Style
=
"{StaticResource PhoneTextAccentStyle}"
VerticalAlignment
=
"Top"
></
TextBlock
>
<
Button
Grid.Row
=
"3"
Style
=
"{StaticResource CtxButton}"
IsEnabled
=
"{Binding Path=Phone, Converter={StaticResource ValueToVisibilityConverter}}"
Click
=
"mobilecallclick"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"Call: "
/>
<
TextBlock
Text
=
"{Binding Phone}"
/>
</
StackPanel
>
</
Button
>
<
Button
Grid.Row
=
"4"
Style
=
"{StaticResource CtxButton}"
IsEnabled
=
"{Binding Path=Phone, Converter={StaticResource ValueToVisibilityConverter}}"
Click
=
"mobilesmsclick"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"SMS: "
/>
<
TextBlock
Text
=
"{Binding Phone}"
/>
</
StackPanel
>
</
Button
>
<
Button
Grid.Row
=
"5"
Style
=
"{StaticResource CtxButton}"
IsEnabled
=
"{Binding Path=Phone, Converter={StaticResource ValueToVisibilityConverter}}"
Click
=
"phonecallclick"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"Call: "
/>
<
TextBlock
Text
=
"{Binding Phone}"
/>
</
StackPanel
>
</
Button
>
<
Button
Grid.Row
=
"6"
Style
=
"{StaticResource CtxButton}"
IsEnabled
=
"{Binding Path=Email, Converter={StaticResource ValueToVisibilityConverter}}"
Click
=
"emailclick"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"eMail: "
/>
<
TextBlock
Text
=
"{Binding Phone}"
/>
</
StackPanel
>
</
Button
>
<
Button
Grid.Row
=
"7"
Style
=
"{StaticResource CtxButton}"
IsEnabled
=
"{Binding Path=Email, Converter={StaticResource ValueToVisibilityConverter}}"
Click
=
"mapclick"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"Map"
/>
</
StackPanel
>
</
Button
>
</
Grid
>
</
Border
>
</
telerikPrimitives:RadModalWindow
>
<
controls:Pivot
x:Name
=
"ContentPanel"
Grid.Row
=
"1"
Title
=
"{Binding Path=ApplicationTitle}"
>
<
controls:PivotItem
Name
=
"Today"
Header
=
"Today"
DataContext
=
"{Binding Path=Agenda.Today}"
Style
=
"{StaticResource PhotoVieweritemStyle}"
/>
<
controls:PivotItem
Name
=
"Next7"
Header
=
"Next 7days"
DataContext
=
"{Binding Path=Agenda.Next7}"
Style
=
"{StaticResource PhotoVieweritemStyle}"
/>
<
controls:PivotItem
Name
=
"Next30"
Header
=
"Next 30days"
DataContext
=
"{Binding Path=Agenda.Next30}"
Style
=
"{StaticResource PhotoVieweritemStyle}"
/>
</
controls:Pivot
>
<
StackPanel
Orientation
=
"Horizontal"
Grid.Row
=
"2"
>
<
TextBlock
Text
=
"Last Refresh on: "
Style
=
"{StaticResource PhoneTextSmallStyle}"
/>
<
TextBlock
Text
=
"{Binding Agenda.LoadedOn}"
Style
=
"{StaticResource PhoneTextSmallStyle}"
/>
</
StackPanel
>
</
Grid
>
</
phone:PhoneApplicationPage
>