Data Binding in RadWindow and RadWindow.ApplicationBarInfo

8 posts, 0 answers
  1. Ove
    Ove avatar
    9 posts
    Member since:
    May 2011

    Posted 21 Jun 2011 Link to this post

    Hi
    How do I bind the Text property of the aplicatiobbar button.
    Both the 2 following lines fails with message> Set property 'Telerik.Windows.Controls.ApplicationBarButton.Text' threw an exception. [Line: 81 Position: 52]

    Text

     

     

    ="{Binding Path=Localizedresources.AppBarCapturePhoto,Source={StaticResource LocalizedStrings}}" />

     

    Text

     

     

    ="{Binding ApplicationTitle}" />

     

    They work if i put them on an other control on the page. What am I doing wrong?
    Below is xaml for the page.

    <

     

     

    phone:PhoneApplicationPage

     

     

     

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

     

     

     

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

     

     

     

    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"

     

     

     

    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"

     

     

     

    xmlns:tilt="clr-namespace:MomentumPMMobile.ControlTiltEffect"

     

     

     

    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"

     

     

     

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

     

     

     

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

     

     

     

    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"

     

     

     

    xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"

     

     

     

    xmlns:il="clr-namespace:Microsoft.Expression.Interactivity.Layout;assembly=Microsoft.Expression.Interactions"

     

     

     

    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"

     

     

     

    xmlns:MyInteractivity="clr-namespace:MomentumPMMobile.Interactivity"

     

     

     

    xmlns:local="clr-namespace:MomentumPMMobile.Infrastructure"

     

     

     

    xmlns:local2="clr-namespace:MomentumPMMobile.UserControls.View"

     

     

     

    xmlns:im="clr-namespace:Microsoft.Expression.Interactivity.Media;assembly=Microsoft.Expression.Interactions"

     

     

     

    xmlns:telerikPrimitives="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"

     

     

     

    xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"

     

     

     

    DataContext="{Binding Camera, Source={StaticResource Locator}}"

     

     

     

    x:Class="MomentumPMMobile.Views.Camera.CameraView3"

     

     

     

    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"

     

     

     

    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"

     

     

     

    shell:SystemTray.IsVisible="False"

     

     

     

    tilt:TiltEffect.IsTiltEnabled="True"

     

     

     

    ApplicationBar="{Binding MainViewApplicationBar}">

     

     

     

     

     

    <!--LayoutRoot is the root grid where all page content is placed-->

     

     

     

     

    <!--DataContext="{Binding Source={StaticResource SampleDataSource1}}"-->

     

     

     

     

    <Grid x:Name="LayoutRoot">

     

     

     

     

    <Grid.Background>

     

     

     

     

    <ImageBrush ImageSource="/Images/PageBackground.png" Stretch="Fill" />

     

     

     

     

    </Grid.Background>

     

     

     

     

    <Grid.RowDefinitions>

     

     

     

     

    <RowDefinition Height="7"/>

     

     

     

     

    <RowDefinition Height="*"/>

     

     

     

     

    </Grid.RowDefinitions>

     

     

     

     

    <ProgressBar

     

     

     

    Foreground="{StaticResource ProgressBarColor}"

     

     

     

    IsIndeterminate="{Binding ShowProgressBar}"

     

     

     

    Visibility="{Binding ShowProgressBar,Converter={StaticResource BooleanToVisibilityConverters}}"

     

     

     

    Grid.Row="0"/>

     

     

     

     

    <!--Pivot Control-->

     

     

     

     

    <controls:Pivot Grid.Row="1" x:Name="CameraPivot" Title="{Binding ApplicationTitle}" SelectedIndex="{Binding SelectedPivotIndex,Mode=TwoWay}">

     

     

     

     

    <!--Pivot item Pictures-->

     

     

     

     

    <!--<controls:PivotItem Header="{Binding Path=Localizedresources.SurveyPictures,Source={StaticResource LocalizedStrings}}"-->

     

     

     

     

    <controls:PivotItem Header="{Binding Path=Localizedresources.AppBarCapturePhoto,Source={StaticResource LocalizedStrings}}"

     

     

     

    Margin="24,0,0,0">

     

     

     

     

    <Grid Grid.Row="1">

     

     

     

     

    <ListBox SelectedIndex="{Binding Camera.SelectedListIndex, Mode=TwoWay,Source={StaticResource Locator}}" x:Name="listBox" ItemTemplate="{StaticResource Pictures}" ItemsSource="{Binding CameraPictures}" Margin="8" Background="{x:Null}" >

     

     

     

     

    <Custom:Interaction.Triggers>

     

     

     

     

    <Custom:EventTrigger EventName="MouseEnter">

     

     

     

     

    <GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding Camera.ListBoxEnterCommand,Source={StaticResource Locator}}" PassEventArgsToCommand="True"/>

     

     

     

     

    </Custom:EventTrigger>

     

     

     

     

    </Custom:Interaction.Triggers>

     

     

     

     

    <toolkit:ContextMenuService.ContextMenu>

     

     

     

     

    <toolkit:ContextMenu tilt:TiltEffect.IsTiltEnabled="True" IsZoomEnabled="False" >

     

     

     

     

    <toolkit:MenuItem Header="Ta bort bild">

     

     

     

     

    <Custom:Interaction.Triggers>

     

     

     

     

    <Custom:EventTrigger EventName="Click">

     

     

     

     

    <GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding Camera.MenuitemCommand,Source={StaticResource Locator}}" CommandParameter="{Binding listbox.SelectedItem}"/>

     

     

     

     

    </Custom:EventTrigger>

     

     

     

     

    </Custom:Interaction.Triggers>

     

     

     

     

    </toolkit:MenuItem>

     

     

     

     

    </toolkit:ContextMenu>

     

     

     

     

    </toolkit:ContextMenuService.ContextMenu>

     

     

     

     

    </ListBox>

     

     

     

     

    <telerikPrimitives:RadWindow x:Name="windowPicture" IsOpen="{Binding IswindowPictureOpen,Mode=TwoWay}" WindowSizeMode="FitToPlacementTarget" IsFullScreen="True" >

     

     

     

     

    <telerikPrimitives:RadWindow.Background>

     

     

     

     

    <ImageBrush ImageSource="/Images/PageBackground.png" Stretch="Uniform" />

     

     

     

     

    </telerikPrimitives:RadWindow.Background>

     

     

     

     

    <telerikPrimitives:RadWindow.ApplicationBarInfo>

     

     

     

     

    <telerikPrimitives:ApplicationBarInfo >

     

     

     

     

    <telerikPrimitives:ApplicationBarButton x:Name="iconButtonCapturePicture" IconUri="/Images/appbar_white.camera.png"

     

     

     

    Text="{Binding Path=Localizedresources.AppBarCapturePhoto,Source={StaticResource LocalizedStrings}}" />

     

     

     

     

    <telerikPrimitives:ApplicationBarButton x:Name="iconButtonCancel" IconUri="/Images/appbar.cancel.rest.png"

     

     

     

    Text="{Binding ApplicationTitle}" />

     

     

     

     

    <telerikPrimitives:ApplicationBarButton x:Name="iconButtonDelete" IconUri="/Images/appbar.delete.rest.png"

     

     

     

    Text="Ta bort" />

     

     

     

     

    <telerikPrimitives:ApplicationBarButton x:Name="iconButtonSave" IconUri="/Images/appbar.save.rest.png"

     

     

     

    Text="Spara" />

     

     

     

     

     

    </telerikPrimitives:ApplicationBarInfo>

     

     

     

     

    </telerikPrimitives:RadWindow.ApplicationBarInfo>

     

     

     

     

     

     

    <Custom:Interaction.Triggers>

     

     

     

     

    <Custom:EventTrigger EventName="WindowClosing">

     

     

     

     

    <GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding Camera.CloseRadwindowCommand,Source={StaticResource Locator}}" PassEventArgsToCommand="True"/>

     

     

     

     

    </Custom:EventTrigger>

     

     

     

     

    </Custom:Interaction.Triggers>

     

     

     

     

    <Border BorderThickness="{StaticResource PhoneBorderThickness}" CornerRadius="5" >

     

     

     

     

    <Border.BorderBrush>

     

     

     

     

    <SolidColorBrush Color="{StaticResource PhoneAccentColor}"/>

     

     

     

     

    </Border.BorderBrush>

     

     

     

     

    <Grid>

     

     

     

     

    <!--<Grid x:Name="MasterDetailGrid" DataContext="{Binding SelectedItem, ElementName=listBox, Mode=TwoWay}" d:DataContext="{Binding CameraPictures[0]}">-->

     

     

     

     

    <Grid x:Name="MasterDetailGrid" DataContext="{Binding Pictureobj, Mode=TwoWay}">

     

     

     

     

    <Grid.ColumnDefinitions>

     

     

     

     

    <ColumnDefinition Width="50*"/>

     

     

     

     

    <ColumnDefinition Width="50*"/>

     

     

     

     

    </Grid.ColumnDefinitions>

     

     

     

     

    <Grid.RowDefinitions>

     

     

     

     

    <RowDefinition Height="Auto"/>

     

     

     

     

    <RowDefinition/>

     

     

     

     

    <RowDefinition Height="Auto"/>

     

     

     

     

    </Grid.RowDefinitions>

     

     

     

     

    <TextBlock Margin="8,0" Text="{Binding CapturedBy}" Height="30" Width="180"/>

     

     

     

     

    <TextBlock Text="{Binding CapturedDate}" Margin="8,0" Grid.Column="1" Height="30"/>

     

     

     

     

    <TextBox Margin="0" Text="{Binding Note,Mode=TwoWay}" Height="140" Grid.Row="2" Grid.ColumnSpan="2" BorderBrush="#BF0C0000">

     

     

     

     

    <i:Interaction.Behaviors>

     

     

     

     

    <MyInteractivity:UpdateTextBindingOnPropertyChanged/>

     

     

     

     

    </i:Interaction.Behaviors>

     

     

     

     

    <Custom:Interaction.Triggers>

     

     

     

     

    <Custom:EventTrigger EventName="GotFocus">

     

     

     

     

    <GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding Camera.UpdateChangeCommand,Mode=OneWay,Source={StaticResource Locator}}"/>

     

     

     

     

    </Custom:EventTrigger>

     

     

     

     

    </Custom:Interaction.Triggers>

     

     

     

     

    </TextBox>

     

     

     

     

    <Image Source="{Binding Picture, Converter={StaticResource ByteImageConverter},Mode=TwoWay}" HorizontalAlignment="Stretch" Margin="8,8,8,0" Grid.Row="1" Grid.ColumnSpan="2" Stretch="Fill">

     

     

     

     

     

    </Image>

     

     

     

     

    <Border BorderBrush="Black" BorderThickness="3" Margin="8,8,8,0" Grid.Row="1" HorizontalAlignment="Stretch" Grid.ColumnSpan="2"/>

     

     

     

     

    </Grid>

     

     

     

     

    </Grid>

     

     

     

     

    </Border>

     

     

     

     

    </telerikPrimitives:RadWindow>

     

     

     

     

    </Grid>

     

     

     

     

    </controls:PivotItem>

     

     

     

     

     

    </controls:Pivot>

     

     

     

     

    <local2:CustomMessageBox x:Name="DialogControl" Grid.RowSpan="2"/>

     

     

     

     

    </Grid>

     

     

     

     

    <!--Sample code showing usage of ApplicationBar-->

     

     

     

     

    <!--<phone:PhoneApplicationPage.ApplicationBar>

     

    <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">

    <shell:ApplicationBarIconButton x:Name="appbar_button1" IconUri="/Images/appbar_button1.png" Text="Button 1"/>

    <shell:ApplicationBarIconButton x:Name="appbar_button2" IconUri="/Images/appbar_button2.png" Text="Button 2"/>

    <shell:ApplicationBar.MenuItems>

    <shell:ApplicationBarMenuItem x:Name="menuItem1" Text="MenuItem 1"/>

    <shell:ApplicationBarMenuItem x:Name="menuItem2" Text="MenuItem 2"/>

    </shell:ApplicationBar.MenuItems>

    </shell:ApplicationBar>

    </phone:PhoneApplicationPage.ApplicationBar>-->

     

    </

     

     

    phone:PhoneApplicationPage>

     


  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 24 Jun 2011 Link to this post

    Hi Ove,

     Thank you for writing.

    The application bar in RadWindow is a wrapper around the native application bar and the buttons and the bar itself are not DependencyObject instances therefore the Text and IconUri are not DependencyProperties and the bindings will not work. We created this wrapper in order to be able to use RadWindow in a normal Silverlight environment for testing purposes.
    If this issue is critical for you, we will consider modifying the application bar info so that it is a DependencyObject for the Q2 2011 release.

    I am looking forward to your reply.

    Greetings,
    Victor
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. DevCraft banner
  4. Francisco
    Francisco avatar
    8 posts
    Member since:
    Apr 2011

    Posted 09 Aug 2012 Link to this post

    Hi, sorry to barge in, but I would like to know if this is still in the cards. It would be great to use bindings in the ApplicationBarInfo buttons, currently it is the same problem as with the native application bar.

    Is this still planned?

    Thanks!
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 13 Aug 2012 Link to this post

    Hi Francisco,

    Thanks for writing.
    Yes this is currently implemented in our development branch. The new app bar will available in the next release.
    Please write again if you have other questions.

    Greetings,
    Victor
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. StevenDale
    StevenDale avatar
    100 posts
    Member since:
    Apr 2007

    Posted 02 Feb 2013 Link to this post

    Where can I find it? Is it also available for windows phone 8 controls?

    Thanks

    Billy Jacobs
  7. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 04 Feb 2013 Link to this post

    Hello Billy,

    Yes, the app bar was updated a while ago and it is available in both the WP7 and WP8 versions.

    All the best,
    Victor
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  8. StevenDale
    StevenDale avatar
    100 posts
    Member since:
    Apr 2007

    Posted 05 Feb 2013 Link to this post

    Where can I find it? I don't see it in the WP telerik examples. Can you provide a small xaml snippet?

    Thanks,

    Billy Jacobs
  9. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 06 Feb 2013 Link to this post

    Hi Billy,

    There is nothing new about the app bar, it is used just like before, however, now you can bind the properties of the app bar buttons to other properties via the Silverlight data binding mechanism.

    Regards,
    Victor
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Back to Top
DevCraft banner