I am trying to put ProgressIndicator for page loading indication in Windows Mobile 8.0, but can't manage to show progress bar at correct stage.
My code:
<shell:SystemTray.ProgressIndicator>
<shell:ProgressIndicator IsIndeterminate="false" IsVisible="True" x:Name="progres"/>
</shell:SystemTray.ProgressIndicator>
and in event handler of a button i put
private void Scalefind_Click(object sender, RoutedEventArgs e)
{
progres.IsIndeterminate = true;
NavigationService.Navigate(new Uri("/Scales.xaml", UriKind.Relative));
progres.IsIndeterminate = false;
}
but indicator doesn't show up. if i comment the progres.IsIndeterminate = false;
Progress bar shows, when I return back to page.
I couldn't find how to show progress bar, when i click the button until the page loads.
Thanks for your help.
Scales.xmal
<phone:PhoneApplicationPage
x:Class="Scale_Finder.Page1"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Landscape" Orientation="Landscape"
mc:Ignorable="d"
shell:SystemTray.IsVisible="False" Unloaded="PhoneApplicationPage_Unloaded" Loaded="PhoneApplicationPage_Loaded">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="110"/>
<RowDefinition Height="5"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,8">
<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle2Style}"/>
</StackPanel>
<StackPanel Name="Notes" Grid.Row="1" Orientation="Horizontal">
<toolkit:ListPicker x:Name="D1" Header="{Binding Path=LocalizedResources.D1, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D1Header, Source={StaticResource LocalizedStrings}}">
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize="32"/>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
<toolkit:ListPicker x:Name="D2" Header="{Binding Path=LocalizedResources.D2, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D2Header, Source={StaticResource LocalizedStrings}}">
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize="32"/>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
<toolkit:ListPicker x:Name="D3" Header="{Binding Path=LocalizedResources.D3, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D3Header, Source={StaticResource LocalizedStrings}}">
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize="32"/>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
<toolkit:ListPicker x:Name="D4" Header="{Binding Path=LocalizedResources.D4, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D4Header, Source={StaticResource LocalizedStrings}}">
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize="32"/>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
<toolkit:ListPicker x:Name="D5" Header="{Binding Path=LocalizedResources.D5, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D5Header, Source={StaticResource LocalizedStrings}}">
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize="32"/>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
<toolkit:ListPicker x:Name="D6" Header="{Binding Path=LocalizedResources.D6, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D6Header, Source={StaticResource LocalizedStrings}}">
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize="32"/>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
<toolkit:ListPicker x:Name="D7" Header="{Binding Path=LocalizedResources.D7, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.D7Header, Source={StaticResource LocalizedStrings}}">
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize="32"/>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
<StackPanel Orientation="Vertical">
<Button x:Name="FindScalesBtn" Content="{Binding Path=LocalizedResources.FindscalesButtonText, Source={StaticResource LocalizedStrings}}" Click="FindScaleClick" Margin="0,0,0,0" FontSize="18" BorderThickness="1"/>
<Button x:Name="ClearBtn" Content="{Binding Path=LocalizedResources.ClearButtonText, Source={StaticResource LocalizedStrings}}" Click="ClearClick" Margin="0,0,0,0" FontSize="18" BorderThickness="1"/>
</StackPanel>
<toolkit:ListPicker x:Name="Ariza" Header="{Binding Path=LocalizedResources.Ariza, Source={StaticResource LocalizedStrings}}" Width="45" FullModeHeader="{Binding Path=LocalizedResources.ArizaHeader, Source={StaticResource LocalizedStrings}}" ExpansionMode="FullScreenOnly" SelectionChanged="AccidentalsSelectionChanged">
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize="52"/>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
</StackPanel>
<!--ContentPanel - place additional content here-->
<ScrollViewer Grid.Row="3" Name="StandartScalesViewer" VerticalScrollBarVisibility="Visible" ManipulationMode="Control">
<StackPanel x:Name="StandartScalesStackPanel" Orientation="Vertical">
<ListBox x:Name="ScaleOutput">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontFamily="Courier New"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</ScrollViewer>
<ScrollViewer Grid.Row="4" Name="CustomScalesVivewer" VerticalScrollBarVisibility="Visible" ManipulationMode="Control">
<StackPanel x:Name="CustomScalesStackPanel" Orientation="Vertical">
<ListBox x:Name="CustomScalesOutput">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontFamily="Courier New" Foreground="Blue"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</ScrollViewer>
<!--Uncomment to see an alignment grid to help ensure your controls are
aligned on common boundaries. The image has a top margin of -32px to
account for the System Tray. Set this to 0 (or remove the margin altogether)
if the System Tray is hidden.
Before shipping remove this XAML and the image itself.-->
<!--<Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" />-->
</Grid>
</phone:PhoneApplicationPage>
I found the solution on Nokia Developer site, which is working exactly as i needed.
Custom splash screen with progress bar for Windows Phone applications
Related
I'm filling a two WrapPanel with Buttons via DataTemplate but they all align vertically for some reason, what exactly is wrong here?
It doesn't matter if I set the Orientation property or not.
XAML:
<UserControl x:Class="DashboardClient.View.DashboardView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
Width="940" Height="640">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<DockPanel Grid.Column="0" Height="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}},Path=ActualHeight}">
<ScrollViewer VerticalScrollBarVisibility="Auto" DockPanel.Dock="Top" Height="520" Margin="5">
<WrapPanel>
<ItemsControl ItemsSource="{Binding Dashboards}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Width="120" Height="120" Margin="5" Command="{Binding DataContext.DashboardCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding}">
<TextBlock TextWrapping="Wrap" HorizontalAlignment="Center" Text="{Binding Name}" />
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Width="120" Height="120" Margin="5" Command="{Binding DashboardAddCommand}" Content="+" FontSize="100" />
</WrapPanel>
</ScrollViewer>
<StackPanel Height="100" Margin="5">
<Label>Dashboardname:</Label>
<TextBox Text="{Binding SelectedDashboard.Name}" />
<RadioButton Content="Sichtbar" Margin="0 10" IsChecked="{Binding SelectedDashboard.IsVisibleOnDashboard, UpdateSourceTrigger=PropertyChanged}" />
<Button Content="Dashboard löschen" Command="{Binding DashboardRemoveCommand}" />
</StackPanel>
</DockPanel>
<StackPanel Grid.Column="1" Margin="0">
<ScrollViewer VerticalScrollBarVisibility="Auto" Height="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type StackPanel}},Path=ActualHeight}">
<WrapPanel>
<ItemsControl ItemsSource="{Binding SelectedDashboard.DashboardItems}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Width="200" Height="120" Command="{Binding DataContext.DashboardItemCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding}" Margin="10">
<TextBlock TextWrapping="Wrap" HorizontalAlignment="Center" Text="{Binding Name}" />
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Width="200" Height="120" Content="+" FontSize="100" Command="{Binding DashboardItemAddCommand}" Margin="10" />
</WrapPanel>
</ScrollViewer>
</StackPanel>
</Grid>
</UserControl>
This is what the WrapPanel looks like:
The Add Button is always cut off somehow, too.
If you want to put the children of the ItemsControl horizontally in a WrapPanel, you need to tell the ItemsControl to use a WrapPanel for its children via an ItemsPanelTemplate:
<WrapPanel Orientation="Horizontal">
<ItemsControl ItemsSource="{Binding Dashboards}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button
Width="120"
Height="120"
Margin="5"
Command="{Binding DataContext.DashboardCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
CommandParameter="{Binding}"
>
<TextBlock
TextWrapping="Wrap"
HorizontalAlignment="Center"
Text="{Binding Name}"
/>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
<Button
Width="120"
Height="120"
Margin="5"
VerticalAlignment="Top"
Command="{Binding DashboardAddCommand}"
Content="+"
FontSize="100"
/>
</WrapPanel>
I don't know what you want to do with the button. My guess is that you want it to the right of the ItemsControl, and I aligned it to the top because that makes more sense to me.
Instead of
<ScrollViewer>
<WrapPanel>
<ItemsControl ItemsSource="{Binding Dashboards}">
<ItemsControl.ItemTemplate ... />
</ItemsControl>
<Button Content="+" ... />
</WrapPanel>
</ScrollViewer>
You can use
<ScrollViewer>
<ItemsControl ItemsSource="{Binding Dashboards}">
<ItemsControl.ItemTemplate ... />
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
<Button Content="+" ... /> <!-- A -->
</ScrollViewer>
<Button Content="+" ... /> <!-- B -->
WrapPanel is moved inside ItemsControl to layout dashboards.
You can put button somewhere else (same as #EdPlunkett I don't have a good idea where to put it): A - will let you to scroll button together with dashboards and B will keep button fixed, disregards scrolling.
I have a WPF app with a few checkboxes. I am able to set the IsChecked property in XAML, however, when I go to set it programatically, there is no such property. From everything I read, this property (IsChecked) is how I should be setting the value.
The XAML is below:
<Window x:Class="FC.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="FCSX Utility" SizeToContent="WidthAndHeight" ResizeMode="NoResize" Background="WhiteSmoke" Loaded="Window_Loaded">
<Window.InputBindings>
<KeyBinding Key="N"
Modifiers="Control"
Command="ApplicationCommands.Properties" />
<KeyBinding Key="S"
Modifiers="Control"
Command="ApplicationCommands.Print" />
<KeyBinding Key="L"
Modifiers="Control"
Command="ApplicationCommands.PrintPreview" />
<KeyBinding Key="I"
Modifiers="Control"
Command="ApplicationCommands.CancelPrint" />
</Window.InputBindings>
<TabControl Name="tcTabs" SelectionChanged="tcTabs_SelectionChanged">
<TabItem Name="tciClock" Header="Clock">
<StackPanel Name="spClock" Orientation="Vertical" Margin="0">
<Label FontWeight="Bold">Clock</Label>
<StackPanel Orientation="Vertical" Margin="10">
<StackPanel Orientation="Horizontal" Margin="10">
<Label>Start Time</Label>
<ComboBox Name="cbHour"></ComboBox>
<Label>:</Label>
<ComboBox Name="cbMinute"></ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="10">
<Label>Day Of Week</Label>
<ComboBox Name="cbClockDay"></ComboBox>
</StackPanel>
<Button Name="btnSetClockSystemTime" Click="btnSetClockSystemTime_Click">Set To Current System Time</Button>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Name ="ckbAlarm1" FontWeight="Bold">Alarm 1</Label>
<CheckBox VerticalAlignment="Center" IsChecked="False"></CheckBox>
</StackPanel>
<StackPanel Name="spAlarm1" Orientation="Vertical" Margin="10">
<StackPanel Orientation="Horizontal" Margin="10">
<Label>Start Time</Label>
<ComboBox Name="cbAlarm1StartHour"></ComboBox>
<Label>:</Label>
<ComboBox Name="cbAlarm1StartMinute"></ComboBox>
<Label>Duration</Label>
<ComboBox Name="cbAlarm1DurationHour"></ComboBox>
<Label>hrs</Label>
<ComboBox Name="cbAlarm1DurationMinute"></ComboBox>
<Label>min</Label>
</StackPanel>
<Label>Days:</Label>
<StackPanel Orientation="Horizontal" Margin="10">
<CheckBox Name="ckbAlarm1Mon">Mon</CheckBox>
<CheckBox Name="ckbAlarm1Tues">Tue</CheckBox>
<CheckBox Name="ckbAlarm1Wed">Wed</CheckBox>
<CheckBox Name="ckbAlarm1Thu">Thu</CheckBox>
<CheckBox Name="ckbAlarm1Fri">Fri</CheckBox>
<CheckBox Name="ckbAlarm1Sat">Sat</CheckBox>
<CheckBox Name="ckbAlarm1Sun">Sun</CheckBox>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label FontWeight="Bold">Alarm 2</Label>
<CheckBox Name="ckbAlarm2" VerticalAlignment="Center"></CheckBox>
</StackPanel>
<StackPanel Name="spAlarm2" Orientation="Vertical" Margin="10">
<StackPanel Orientation="Horizontal" Margin="10">
<Label>Start Time</Label>
<ComboBox Name="cbAlarm2StartHour"></ComboBox>
<Label>:</Label>
<ComboBox Name="cbAlarm2StartMinute"></ComboBox>
<Label>Duration</Label>
<ComboBox Name="cbAlarm2DurationHour"></ComboBox>
<Label>hrs</Label>
<ComboBox Name="cbAlarm2DurationMinute"></ComboBox>
<Label>min</Label>
</StackPanel>
<Label>Days:</Label>
<StackPanel Orientation="Horizontal" Margin="10">
<CheckBox Name="ckbAlarm2Mon">Mon</CheckBox>
<CheckBox Name="ckbAlarm2Tues">Tue</CheckBox>
<CheckBox Name="ckbAlarm2Wed">Wed</CheckBox>
<CheckBox Name="ckbAlarm2Thu">Thu</CheckBox>
<CheckBox Name="ckbAlarm2Fri">Fri</CheckBox>
<CheckBox Name="ckbAlarm2Sat">Sat</CheckBox>
<CheckBox Name="ckbAlarm2Sun">Sun</CheckBox>
</StackPanel>
</StackPanel>
<Button>Apply</Button>
</StackPanel>
</TabItem>
<TabItem Name="tciTrigger" Header="Triggering">
<StackPanel Name="spTrigger" Orientation="Vertical">
<StackPanel Orientation="Vertical" Margin="10">
<Label FontWeight="Bold">Trigger Options</Label>
<StackPanel Margin="10">
<Label>Reset Delay</Label>
<StackPanel Orientation="Horizontal">
<TextBox Width="100"></TextBox>
<Label>ms</Label>
</StackPanel>
<Label>Arm Delay</Label>
<StackPanel Orientation="Horizontal">
<TextBox Width="100"></TextBox>
<Label>ms</Label>
</StackPanel>
<Label>Take Delay A</Label>
<StackPanel Orientation="Horizontal">
<TextBox Width="100"></TextBox>
<Label>ms</Label>
</StackPanel>
<Label>Take Delay B</Label>
<StackPanel Orientation="Horizontal">
<TextBox Width="100"></TextBox>
<Label>ms</Label>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="10">
<Label FontWeight="Bold">Trigger Sources</Label>
<CheckBox>Internal Motion Sensor</CheckBox>
<CheckBox>External Sensor</CheckBox>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="10">
<Label FontWeight="Bold">Pre-Trigger Options</Label>
<CheckBox>Enable Pre-Trigger</CheckBox>
<StackPanel Margin="10">
<RadioButton>Pre-Trigger on Internal</RadioButton>
<RadioButton>Pre-Trigger on External</RadioButton>
<Label>Pre-Tigger Reset Time</Label>
<StackPanel Orientation="Horizontal">
<TextBox Width="100"></TextBox>
<Label>ms</Label>
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
</TabItem>
<TabItem Name="tciDebug" Header="Debug" Visibility="Collapsed">
<StackPanel Orientation="Vertical" Margin="10">
<Label>Command Line Output</Label>
<TextBlock TextWrapping="WrapWithOverflow"></TextBlock>
</StackPanel>
</TabItem>
<TabItem Header="FW Update">
<StackPanel Orientation="Vertical" Margin="10">
<TextBlock Margin="5" FontSize="14">Welcome!</TextBlock>
<TextBlock Margin="5" FontSize="14">This utility is used to update the firmware of your FC device.</TextBlock>
<TextBlock Margin="5" FontSize="14">Please follow the steps below:</TextBlock>
<Border Margin="2" BorderBrush="Black" BorderThickness="1" Background="White">
<StackPanel Orientation="Vertical" Margin="10,10,10,10" Background="White">
<Image Name="imgUpdate" Source="/FC-Update;component/Update.png" Width="450" Margin="10" Visibility="Visible" />
<StackPanel Margin="5" Orientation="Horizontal">
<TextBlock Margin="0,0,15,0" Name="lblStep1">Step 1: Connect your FC to the USB port and place<LineBreak/> the jumper in the right position.</TextBlock>
<TextBlock Name="lblStep1Done" Visibility="Collapsed">[DEVICE DETECTED]</TextBlock>
</StackPanel>
<StackPanel Margin="5" Orientation="Horizontal">
<TextBlock Margin="0,0,15,0" Name="lblStep2">Step 2: Power off the FCand power it back on.<LineBreak/>You should NOT hear any tones but the LED should be lit.<LineBreak/>When done click the 'Continue' button -></TextBlock>
<TextBlock Name="lblStep2Done" Visibility="Collapsed">[DONE]</TextBlock>
<Button Name="btnStep2Continue" Click="btnStep2Continue_Click" Visibility="Hidden" Padding="10,2,10,2" Height="30">Continue</Button>
</StackPanel>
<TextBlock Margin="5" Name="lblStep3">
Step 3: Click 'Choose Firmware Update...', then navigate to the provided .bin firmware update file.<LineBreak/>
After you select the file and click 'Open', the update will start automatically.
</TextBlock>
<Button Name="btnGo" Width="200" Height="30" Margin="10,10,10,5" HorizontalAlignment="Center" HorizontalContentAlignment="Center" IsEnabled="False" Click="btnGo_Click">Choose Firmware Update...</Button>
<TextBlock Name="lblConnect" Foreground="Red" HorizontalAlignment="Center" Visibility="Visible">The 'Choose Firmware Update...' button will only be enabled when<LineBreak/> your FC is connected via the USB cable and has been reset.</TextBlock>
<TextBlock Name="lblPleaseWait" HorizontalAlignment="Center" Visibility="Collapsed" Foreground="OrangeRed" FontWeight="Bold">Please wait...</TextBlock>
<ProgressBar Name="prgMain" Width="200" Height="25" Margin="10,10,10,10" HorizontalAlignment="Center" HorizontalContentAlignment="Center" Visibility="Collapsed" Minimum="0" Maximum="100"></ProgressBar>
<TextBlock Name="lblResetWait" HorizontalAlignment="Center" Visibility="Collapsed" Foreground="Green">The firmware update was downloaded and your device was reset.<LineBreak/>Please keep this window open as we wait to make sure it re-connects...</TextBlock>
<TextBlock Name="lblSuccess" HorizontalAlignment="Center" Visibility="Collapsed" Foreground="Green">The firmware update was successful and your device re-connected!<LineBreak/>Please complete Step 4 and then close this window.</TextBlock>
<TextBlock Margin="5" Name="lblStep4">
Step 4: Once the update completes successfully,<LineBreak/>remove the jumper and unplug the USB cable.
</TextBlock>
<TextBlock Name="lblError" HorizontalAlignment="Center" Visibility="Collapsed" Foreground="Red">The firmware update was NOT successful.</TextBlock>
<TextBlock Name="lblErrorMessage" HorizontalAlignment="Center" Visibility="Collapsed" Foreground="Red" />
<Image Name="imgNoUpdate" Source="/FC-Update;component/NoUpdate.png" Width="450" Margin="10" Visibility="Collapsed" />
<TextBlock Name="lblAllowLuminary" HorizontalAlignment="Center" Visibility="Collapsed" Background="Red" Foreground="White" Margin="10">Will Allow Luminary EPT Devices. Press Ctrl-L Again to Disallow.</TextBlock>
</StackPanel>
</Border>
</StackPanel>
</TabItem>
</TabControl>
</Window>
if (Regex.Matches(alarm1Data.ToString(), "ALARM 1 DISABLED").Count == 1)
{
spAlarm1.IsEnabled = false;
// ckbAlarm1.IsChecked = false; // <--- property not found
}
<Label Name ="ckbAlarm1" FontWeight="Bold">Alarm 1</Label>
ckbAlarm1 is a LABEL !!
I'm using Microsoft Visual C# 2010 Express and had the same problem, but with a different solution. The correct code for this platform is:
this.checkBoxDebugMode.Checked = World.Setup.Debug;
instead of
this.checkBoxDebugMode.IsChecked = World.Setup.Debug;
IsChecked is not a valid property here, but it's what you find when you look it up.
I have this XAML code:
<ListView Name="ListBoxWithNews" ItemsSource="{Binding News}" Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" Grid.ColumnSpan="2">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding imageURL}" Width="75" Height="75" />
<StackPanel>
<TextBox Text="{Binding Title}" Width="200" />
<TextBox Text="{Binding Body}" Width="200" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
The controls are binded using the MVVM pattern. The user can change the content of the two text boxes. Is there a possible way to get the updated text from these text boxes at some point when I need them?
Your ViewModel should implement INotifyPropertyChanged and Use TwoWay Binding as below
<ListView Name="ListBoxWithNews" ItemsSource="{Binding News,Mode=TwoWay}" Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" Grid.ColumnSpan="2">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding imageURL,Mode=TwoWay}" Width="75" Height="75" />
<StackPanel>
<TextBox Text="{Binding Title,Mode=TwoWay}" Width="200" />
<TextBox Text="{Binding Body,Mode=TwoWay}" Width="200" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
I am making an application in which I want to resize screen area when keyboard is open. Just like in this calendar application of windows phone.
After opening keyboard look screen should resize and also I should be able to scroll till the end of the page without closing keyboard:
In my application i am not able to do these things. In my page last elements of the page stays behind keyboard if i want to access that elements of the page i have to close keyboard but in calendar application of Nokia does great job by re sizing the page somehow so i can access whole part of page even though keyboard is open.
Can somebody help me out in this problem?
Here is code for my page
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="0" Style="{StaticResource HeaderStackPanelStyle}">
<TextBlock TextAlignment="Center" Style="{StaticResource PhoneTextBlockHeaderStyle}" Text="Add Claim Item" />
</StackPanel>
<ScrollViewer Name="MainPageScroller" Grid.Row="1">
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Margin="12,0,12,12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Name="MainContentPenal" Grid.Row="0">
<StackPanel >
<TextBlock TextAlignment="Left" Text="Category" Style="{StaticResource PhoneTextFirstItemStyle}" >
</TextBlock>
<ToolKit:ListPicker x:Name="CategoryListPicker"
ItemsSource="{Binding Categories}" SelectedItem="{Binding SelectedCategory, Mode=TwoWay}" SelectedIndex="{Binding Categories,Converter={StaticResource DefaultSetter}}"
ExpansionMode="FullScreenOnly" SelectionMode="Single" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" SelectionChanged="CategorySelection" ItemTemplate="{StaticResource CategoryTamplate}" FullModeItemTemplate="{ StaticResource CategoryTamplate}" >
</ToolKit:ListPicker>
</StackPanel >
<StackPanel Visibility="{Binding SelectedCategory, Converter={StaticResource TravelMileageHelper}, ConverterParameter=amount}" >
<TextBlock TextAlignment="Left" Text="Amount" Style="{StaticResource PhoneTextFirstItemStyle}" />
<TextBox x:Name="AmountTextBox" Style="{StaticResource WebExpensesTextBoxStyle}" Text="{Binding Amount, Mode=TwoWay}" KeyUp="numericTextBox_keyUp" KeyDown="numericTextBox_keyDown" InputScope="Number" TextChanged="TextChange_Event" />
</StackPanel>
<StackPanel Visibility="{Binding SelectedCategory, Converter={StaticResource TravelMileageHelper},ConverterParameter=mileage}" >
<TextBlock TextAlignment="Left" Text="Mileage units" Style="{StaticResource PhoneTextFirstItemStyle}" />
<TextBox x:Name="mileageTextBox" Text="{Binding MileageUnit, Mode=TwoWay}" Style="{StaticResource WebExpensesTextBoxStyle}" KeyUp="numericTextBox_keyUp" KeyDown="numericTextBox_keyDown" TextWrapping="Wrap" InputScope="Number" TextChanged="TextChange_Event"/>
</StackPanel>
<StackPanel Visibility="{Binding SelectedCategory, Converter={StaticResource TravelMileageHelper}, ConverterParameter=trip}" >
<TextBlock TextAlignment="Left" Text="Mileage" Style="{StaticResource PhoneTextFirstItemStyle}" />
<Button Content="Add mileage" Click="AddMileage"/>
</StackPanel>
<StackPanel Visibility="{Binding SelectedCategory,Converter={StaticResource TravelMileageHelper}, ConverterParameter=trip}" >
<StackPanel Visibility="{Binding TripMasterModel, Mode=TwoWay, Converter={StaticResource VisibiltyHelper}}">
<Grid DataContext="{Binding TripMasterModel}">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0">
<TextBlock TextWrapping="Wrap" HorizontalAlignment="Left" Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Start}"></TextBlock>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="" FontFamily="Segoe UI Symbol" Style="{StaticResource PhoneTextNormalStyle}"/>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="2">
<TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Text="{Binding End}"></TextBlock>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="3">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding Distance}"/>
</StackPanel>
<StackPanel Visibility="{Binding subTrips,Converter={StaticResource VisibiltyHelper}}" Grid.Row="1" Orientation="Horizontal" Grid.ColumnSpan="4" >
<TextBlock HorizontalAlignment="Left" Text="via"/>
<ItemsControl ItemsSource="{Binding subTrips}" ItemTemplate="{StaticResource SubTripTemplate}" HorizontalAlignment="Left">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</StackPanel>
</Grid>
</StackPanel>
</StackPanel>
<StackPanel >
<TextBlock TextAlignment="Left" Text="Description" Style="{StaticResource PhoneTextFirstItemStyle}" />
<TextBox x:Name="DescriptionTextBox" Style="{StaticResource WebExpensesTextBoxStyle}" Text="{Binding Description, Mode=TwoWay}" Height="120" TextWrapping="Wrap" TextChanged="TextChange_Event" KeyDown="DescriptionTextBox_KeyDown"/>
</StackPanel>
<StackPanel >
<ToolKit:DatePicker HeaderTemplate="{StaticResource DatePickerHeader}" Value="{Binding SelectedDate,Mode=TwoWay}" ValueStringFormat="{Binding DateFormat}" HorizontalAlignment="Left" x:Name="DatePicker" VerticalAlignment="Top" Width="200" />
</StackPanel>
<StackPanel Visibility="{Binding Currencies, Converter={StaticResource VisibiltyHelper}}" >
<TextBlock TextAlignment="Left" Text="Currency" Style="{StaticResource PhoneTextFirstItemStyle}" />
<ToolKit:ListPicker x:Name="CurrencyListPicker"
ItemsSource="{Binding Currencies}" SelectedItem="{Binding SelectedCurrency, Mode=TwoWay}"
DisplayMemberPath="Name" SelectedIndex="{Binding Currencies,Converter={StaticResource DefaultSetter}}" FullModeItemTemplate="{ StaticResource CurrencyTamplate}" >
</ToolKit:ListPicker>
</StackPanel>
<StackPanel Visibility="{Binding Clients, Converter={StaticResource VisibiltyHelper}}" >
<TextBlock TextAlignment="Left" Text="Client" Style="{StaticResource PhoneTextFirstItemStyle}"/>
<ToolKit:ListPicker x:Name="ClientListPicker"
ItemsSource="{Binding Clients}" SelectedItem="{Binding SelectedClient, Mode=TwoWay}"
ItemTemplate="{StaticResource ShowMember}" SelectedIndex="{Binding Clients,Converter={StaticResource DefaultSetter}}" FullModeItemTemplate="{ StaticResource ClientTemplate}" >
</ToolKit:ListPicker>
</StackPanel>
<StackPanel Visibility="{Binding SubClients, Converter={StaticResource VisibiltyHelper}}" >
<TextBlock TextAlignment="Left" Text="Subclient" Style="{StaticResource PhoneTextFirstItemStyle}"/>
<ToolKit:ListPicker x:Name="SubClientListPicker"
ItemsSource="{Binding SubClients,Mode=TwoWay}"
DisplayMemberPath="Name" SelectedItem="{Binding SelectedSubclient, Mode=TwoWay}" SelectedIndex="{Binding SubClients,Converter={StaticResource DefaultSetter},Mode=TwoWay}" FullModeItemTemplate="{ StaticResource ClientTemplate}" >
</ToolKit:ListPicker>
</StackPanel>
<StackPanel Visibility="{Binding Vendors, Converter={StaticResource VisibiltyHelper}}" >
<TextBlock TextAlignment="Left" Text="Vendor" Style="{StaticResource PhoneTextFirstItemStyle}"/>
<ToolKit:ListPicker x:Name="VendorListPicker"
ItemsSource="{Binding Vendors}" SelectedItem="{Binding SelectedVendor, Mode=TwoWay}"
DisplayMemberPath="Name" SelectedIndex="{Binding Vendors,Converter={StaticResource DefaultSetter}}" SelectionChanged="vendorSelection" FullModeItemTemplate="{ StaticResource ClientTemplate}" >
</ToolKit:ListPicker>
</StackPanel>
<StackPanel >
<TextBlock TextAlignment="Left" Text="Receipt" Style="{StaticResource PhoneTextFirstItemStyle}"/>
<Button Click="AddReceipt_Btn_Click" Content="Add receipt"/>
</StackPanel>
<StackPanel x:Name="ImagePenal">
<ItemsControl Width="Auto" HorizontalAlignment="Stretch" ItemsSource="{Binding ReceiptList}" ItemTemplate="{StaticResource ImageListTemplate}" >
</ItemsControl>
</StackPanel>
</StackPanel>
</Grid>
</ScrollViewer>
Give your content in between ListBox or ScrollViewer.
<ListBox>
//your textbox and everything
</ListBox>
or
<ScrollViewer>
//your textbox and everything
</ScrollViewer>
I have a ComboBox that has an ItemTemplate with a CheckBox in it (read Dropdown CheckBoxList). I basically want to have a separate binding for the text in the combobox (both when an item is selected, and if an item isn't selected). I've tried a few different methods but either can't seem to get them to work with my setup, or can't find they have some issues. I've even tried a few mixes and matches of them. Usually I find they either don't work when an item isn't specifically selected (which could be possible if the user checks a few boxes then clicks out of the ComboBox), or aren't updating the text properly.
My xaml is this (the items of focus are the DataTemplates with the ComboBoxes in them):
<UserControl x:Class="BestClient.ucReportViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BestClient"
mc:Ignorable="d"
d:DesignHeight="315" d:DesignWidth="388" Background="#FFD7DFEC">
<UserControl.Resources>
<DataTemplate x:Key="datetime">
<StackPanel Orientation="Horizontal" Height="35">
<TextBlock Text="{Binding rfName}" Width="100" VerticalAlignment="Center" />
<DatePicker Tag="{Binding rfParameter}" SelectedDate="{Binding rfValues, Mode=TwoWay}" Width="200" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="office">
<StackPanel Orientation="Horizontal" Height="35">
<TextBlock Text="{Binding rfName}" Width="100" VerticalAlignment="Center" />
<ComboBox x:Name="officeComboBox" Tag="{Binding rfParameter}" Width="200" ItemsSource="{Binding Path=DataContext.OfficeList, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Mode=TwoWay}" VerticalAlignment="Center">
<ComboBox.ItemTemplate>
<DataTemplate>
<CheckBox Tag="{Binding id}" IsChecked="{Binding isSelected}" Width="200" Content="{Binding value}" Margin="2" x:Name="CheckBox" Checked="OfficeCheckBox_Checked"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="carrier">
<StackPanel Orientation="Horizontal" Height="35">
<TextBlock Text="{Binding rfName}" Width="100" VerticalAlignment="Center" />
<ComboBox Tag="{Binding rfParameter}" Width="200" ItemsSource="{Binding Path=DataContext.CarrierList, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Mode=TwoWay}" VerticalAlignment="Center">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox Tag="{Binding id}" IsChecked="{Binding isSelected}" Width="200" Content="{Binding value}" Margin="2"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="defaultTemplate">
<StackPanel Orientation="Horizontal" Height="35">
<TextBlock Text="{Binding rfName}" Width="100" VerticalAlignment="Center" />
<TextBox Tag="{Binding rfParameter}" Width="200" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
<local:ReportFilterTemplateSelector x:Key="ReportFilterTemplateSelector" />
</UserControl.Resources>
<Grid x:Name="ReportViewer">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="45"/>
<RowDefinition Height="*"/>
<RowDefinition Height="45"/>
</Grid.RowDefinitions>
<Viewbox Grid.Row="0" Grid.Column="0">
<TextBlock Margin="10" TextWrapping="Wrap" Text="Select a Report:"/>
</Viewbox>
<ComboBox Grid.Column="1" Margin="10" Grid.ColumnSpan="2" ItemsSource="{Binding ReportList}" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedItem="{Binding SelectedReport}" VerticalContentAlignment="Center" />
<ListView x:Name="FilterList" Margin="10,0" Grid.Row="1" Grid.ColumnSpan="3" ItemTemplateSelector="{StaticResource ReportFilterTemplateSelector}" ItemsSource="{Binding reportFilters, Mode=TwoWay}" />
<Button Command="{Binding OpenReport}" Content="Open Report" Grid.Column="2" Margin="10" Grid.Row="2" VerticalAlignment="Stretch"/>
</Grid>
</UserControl>
Ideally, I'd like to bind the display text of the combobox with the OfficeListValues method in my ViewModel.
{Binding Path=DataContext.OfficeListValues, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}
Any help would be appreciated!