I have a content app I have created that displays a list of tracks (for now) that represent different situations. They each have a target button, case #, case type, and date. I am using a telerik:radgridview to achieve this and each row is clickable. When expanding the row you see more information about the situation. One section is called 'Responding Assets'. In this section I want to display a ListBox or anything I can use to display those same tracks again. This is just for testing purposes and I will you a certain set of data later, but I can't get anything to display here. I don't know if there is an issue trying to display another list in a radgrid or what? Any ideas why this isn't working?
.xaml code
<telerik:RadGridView.RowDetailsTemplate>
<DataTemplate>
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="Auto" Background="#303134" Name="RowDetails">
<Grid Margin="10 10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--SUMMARY-->
<Grid Margin="10 10" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Text="SUMMARY" FontSize="14" FontFamily="Segoe UI Bold" Foreground="White" Margin="4 0 0 5" />
<Rectangle Height="1" Fill="#A6A6A6" Grid.Row="1" VerticalAlignment="Center" Margin="2 0 2 10" Stretch="Fill" Grid.ColumnSpan="2" />
<TextBlock Text="Address: " FontSize="12" FontFamily="Segoe UI Bold" Foreground="#A6A6A6" Margin="4 2" Grid.Row="2" />
<TextBlock Text="1501 Main Street Columbia, SC" FontSize="12" FontFamily="Segoe UI" Foreground="#A6A6A6" Margin="4 2"
Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" />
<TextBlock Text="Subtype: " FontSize="12" FontFamily="Segoe UI Bold" Foreground="#A6A6A6" Margin="4 2" Grid.Row="3" />
<TextBlock Text="Active Shooter on Foot" FontSize="12" FontFamily="Segoe UI" Foreground="#A6A6A6" Margin="4 2" Grid.Row="3"
Grid.Column="1" HorizontalAlignment="Left"/>
<TextBlock Text="Dispatch Group: " FontSize="12" FontFamily="Segoe UI Bold" Foreground="#A6A6A6" Margin="4 2" Grid.Row="4"/>
<TextBlock Text="District 22" FontSize="12" FontFamily="Segoe UI" Foreground="#A6A6A6" Margin="4 2" Grid.Row="4" Grid.Column="1"
HorizontalAlignment="Left"/>
</Grid>
<!--COMMENTS-->
<Grid Margin="10 10" Grid.Row="1" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Text="COMMENTS" FontSize="14" FontFamily="Segoe UI Bold" Foreground="White" Margin="4 10 0 5" />
<Rectangle Height="1" Fill="#A6A6A6" Grid.Row="1" VerticalAlignment="Center" Margin="2 0 2 10" Stretch="Fill" />
<TextBlock Text="Event Comments" FontSize="12" FontFamily="Segoe UI Bold" Foreground="#A6A6A6" Margin="4 6" Grid.Row="2"/>
<Border Grid.Row="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="100" BorderBrush="#535354">
<TextBox Grid.Row="3" Name="EventComments" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextAlignment="Left"
Margin="4 0 10 10" TextWrapping="Wrap" Text="Comments from CAD system here" IsReadOnly="True" Height="100" Background="#3F4145"
BorderThickness="0" Foreground="#A6A6A6" />
</Border>
<TextBlock Text="Location Comments" FontSize="12" FontFamily="Segoe UI Bold" Foreground="#A6A6A6" Margin="4 6" Grid.Row="4"/>
<Border Grid.Row="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="100" BorderBrush="#535354">
<TextBox Grid.Row="5" Name="LocationComments" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextAlignment="Left"
Margin="4 0 10 10" TextWrapping="Wrap" IsReadOnly="True" Height="100" Background="#3F4145"
BorderThickness="0" Foreground="#A6A6A6" />
</Border>
</Grid>
<!--RESPONDING ASSETS-->
<Grid Margin="10 10" Grid.Row="2" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="300" />
</Grid.RowDefinitions>
<TextBlock Text="RESPONDING ASSETS" FontSize="14" FontFamily="Segoe UI Bold" Foreground="White" Margin="4 10 0 5" />
<Rectangle Height="1" Fill="#A6A6A6" Grid.Row="1" VerticalAlignment="Center" Margin="2 0 2 10" Stretch="Fill" />
<!--ENTITY LIST-->
<Grid Grid.Row="2">
<ListBox ItemsSource="{Binding FilteredTrackList}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0 5 0 10">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="0 2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding TrackName.Value}" />
<TextBlock Text="{Binding DateCreated}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
</Grid>
</StackPanel>
</DataTemplate>
</telerik:RadGridView.RowDetailsTemplate>
I am not providing the code for how I obtain the FilteredTrackList because this clearly works otherwise I wouldn't have rows to click on in the radgrid.
The DataContext of the ListBox is an individual Entity object. If you want to bind to the same FilteredTrackList as the parent RadGridView binds to, you could use {RelativeSource}:
<ListBox ItemsSource="{Binding DataContext.FilteredTrackList, RelativeSource={RelativeSource AncestorType=telerik:RadGridView}}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0 5 0 10">
Related
I have an interface with some tabs in it on the right side of the screen. I need each tab`s width to be resized by width of the context in it.
All the other tabs do it apart from this one...
Any suggestions, please?
Description
The scales tab in the stackup editor doesn’t resize when selected.
Select the scales tab on the right side of the stackup editor
Right hand tab doesn’t resize
Expected Behaviour
Tab resizes to fit content, as with all other tabs in the stackup
editor
enter image description here
<infrastructure:Plugin x:Class="Xact.GeminiX.Plugin.PanelEditors.Views.DisplayScalesView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:infrastructure="clr-namespace:Xact.GeminiX.Client.Common.Infrastructure;assembly=Xact.GeminiX.Client.Common"
xmlns:converters="clr-namespace:Xact.GeminiX.Client.Wpf.Common.Converters;assembly=Xact.GeminiX.Client.Wpf.Common"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
LayoutUpdated="ViewLayoutUpdated"
Loaded="Plugin_Loaded">
<infrastructure:Plugin.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></BooleanToVisibilityConverter>
<converters:BooleanToVisibilityHiddenOnFalseConverter x:Key="BooleanToVisibilityHiddenOnFalseConverter"></converters:BooleanToVisibilityHiddenOnFalseConverter>
<infrastructure:DataContextProxy x:Key="DataContextProxy"/>
</infrastructure:Plugin.Resources>
<i:Interaction.Behaviors>
<infrastructure:DataContextProxyBehavior DataContextProxy="{StaticResource DataContextProxy}"/>
</i:Interaction.Behaviors>
<Grid Grid.IsSharedSizeScope="True" PreviewMouseWheel="UIElement_OnPreviewMouseWheel">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.Resources>
<ContextMenu x:Key="ImportContextMenu"
ItemsSource="{Binding DataContext.ScalingImportExportMetaData.ScalingImportFormats, Source={StaticResource DataContextProxy}}">
<ContextMenu.ItemContainerStyle>
<Style TargetType="MenuItem">
<Setter Property="Header"
Value="{Binding FormatTitle}"/>
<Setter Property="Command"
Value="{Binding DataContext.FormatSelectionCommand, Source={StaticResource DataContextProxy}}"/>
<Setter Property="CommandParameter"
Value="{Binding}"/>
</Style>
</ContextMenu.ItemContainerStyle>
</ContextMenu>
<ContextMenu x:Key="ImportFromStackupContextMenu">
<MenuItem Header="{Binding StoredLocalisation}" Click="ButtonImportFromStackupStored_OnClick"/>
<MenuItem Header="{Binding RemakesLocalisation}" Click="ButtonImportFromStackupRemakes_OnClick"/>
</ContextMenu>
<ContextMenu x:Key="ContextMenu" ItemsSource="{Binding DataContext.ScalingImportExportMetaData.ScalingExportFormats, Source={StaticResource DataContextProxy}}">
<ContextMenu.ItemContainerStyle>
<Style TargetType="MenuItem">
<Setter Property="Header"
Value="{Binding FormatTitle}"/>
<EventSetter Event="Click"
Handler="MenuItem_OnClick"/>
</Style>
</ContextMenu.ItemContainerStyle>
</ContextMenu>
<DataTemplate x:Key="ExportButtonTemplate">
<telerik:RadButton Content="{Binding TypeTitle}" Click="ButtonBase_OnClick" IsEnabled="{Binding Enabled}" ContextMenu="{StaticResource ContextMenu}" Margin="2"/>
</DataTemplate>
</Grid.Resources>
<ScrollViewer VerticalScrollBarVisibility="Disabled"
HorizontalScrollBarVisibility="Auto"
HorizontalAlignment="Left"
HorizontalContentAlignment="Left"
Grid.Column="0">
<Grid>
<Grid.Resources>
<converters:BooleanInvertConverter x:Key="BooleanInvertConverter"></converters:BooleanInvertConverter>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" SharedSizeGroup="B"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto" SharedSizeGroup="C"/>
<RowDefinition Height="Auto" SharedSizeGroup="D"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Loaded="TopGrid_OnLoaded" HorizontalAlignment="Left" x:Name="Grid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="A" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding LayerLocalisation}" Margin="5" />
<TextBlock Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2" Text="{Binding FirstScaleFactorLocalisation}" HorizontalAlignment="Center" Margin="5" />
<TextBlock Grid.Row="0" Grid.Column="3" Grid.ColumnSpan="2" Text="{Binding SecondScaleFactorLocalisation}" HorizontalAlignment="Center" Margin="5" />
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding ArtworkLocalisation}" HorizontalAlignment="Center" Margin="5" />
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding PredictedLocalisation}" HorizontalAlignment="Center" Margin="5" />
<TextBlock Grid.Row="1" Grid.Column="3" Text="{Binding ArtworkLocalisation}" HorizontalAlignment="Center" Margin="5" />
<TextBlock Grid.Row="1" Grid.Column="4" Text="{Binding PredictedLocalisation}" HorizontalAlignment="Center" Margin="5" />
<Border Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="5"
BorderThickness="0, 1, 0, 0"
Margin="0, 5, 0, 5"
BorderBrush="LightGray" />
<TextBlock Grid.Row="3"
Grid.Column="0"
Text="{Binding AllLocalisation}"
VerticalAlignment="Center"
Margin="5" />
<TextBox x:Name="EnabledTemplate"
Grid.Row="3"
Grid.Column="1"
Margin="5"
Text="{Binding ShortValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
KeyDown="SetShortValues_OnKeyDown"
TextChanged="ShortValueTextbox_TextChanged"
Width="80"
IsEnabled="{Binding ScalesExist}"
MaxLength="10" />
<telerik:RadButton Grid.Row="3"
Grid.Column="2"
Content="{Binding SetFirstLocalisation}"
Click="SetShortButton_OnClick"
IsEnabled="{Binding ScalesExist}"
Margin="2"/>
<TextBox Grid.Row="3"
Grid.Column="3"
Margin="5"
Text="{Binding LongValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
KeyDown="SetLongValues_OnKeyDown"
TextChanged="ShortValueTextbox_TextChanged"
Width="80"
IsEnabled="{Binding ScalesExist}"
MaxLength="10" />
<telerik:RadButton Grid.Row="3"
Grid.Column="4"
Content="{Binding SetSecondLocalisation}"
Click="SetLongButton_OnClick"
IsEnabled="{Binding ScalesExist}"
Margin="2"/>
<CheckBox Grid.Row="4"
Grid.Column="0"
IsEnabled="{Binding ScalesExist}"
IsChecked="{Binding AllCheckboxIsChecked}"
Margin="5"
Click="SetAllCheckBoxToggled" />
<telerik:RadButton Grid.Row="4"
Grid.Column="2"
Content="{Binding PredictedSwapLocalisation}"
Click="PredictedShortButton_OnClick"
IsEnabled="{Binding PredictionsAvailable}"
AutomationProperties.AutomationId="PredictedShortButtonID"
x:Name="PredictedShortButtonID"
Margin="2"/>
<telerik:RadButton Grid.Row="4"
Grid.Column="4"
Content="{Binding PredictedSwapLocalisation}"
Click="PredictedLongButton_OnClick"
IsEnabled="{Binding PredictionsAvailable}"
AutomationProperties.AutomationId="PredictedLongButtonID"
x:Name="PredictedLongButtonID"
Margin="2"/>
<Border Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="5" BorderThickness="0, 1, 0, 0" Margin="0, 10, 0, 10" BorderBrush="LightGray" />
</Grid>
<Grid Grid.Row="1">
<ScrollViewer HorizontalAlignment="Left" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Hidden" Name="ScrollViewer" ScrollChanged="ScrollViewer_OnScrollChanged">
<Grid>
<Grid.Resources>
<DataTemplate x:Key="RowsTemplate">
<Grid x:Name="TemplateGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="A" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0" IsChecked="{Binding IsChecked}" VerticalAlignment="Center" Margin="5" IsEnabled="{Binding Editable}"
Command="{Binding Path=DataContext.CheckBoxChangedCommand, ElementName=Grid}" CommandParameter="{Binding}" />
<TextBlock Grid.Column="1" Text="{Binding Layer}" VerticalAlignment="Center" Margin="5" />
</Grid>
<TextBox Grid.Column="1"
Text="{Binding ShortDisplayValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding Editable}"
Width="80"
Margin="5"
TextChanged="ShortValueTextbox_TextChanged"
KeyDown="FirstUIElement_OnKeyDown"
LostFocus="FirstUIElement_OnLostFocus" />
<telerik:RadButton Grid.Column="2"
Command="{Binding Path=DataContext.SetSinglePredictedShortCommand, ElementName=Grid}"
CommandParameter="{Binding}"
IsEnabled="{Binding Editable}"
Visibility="{Binding Visible}" HorizontalContentAlignment="Left"
Margin="2">
<telerik:RadButton.Content>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Label Background="{Binding ConfidenceBrush}" Foreground="{Binding ConfidenceForegroundBrush}" Height="20" Width="20" Content="{Binding ConfidenceCharacter}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="0"></Label>
<TextBlock Text="{Binding ShortButton}" />
</StackPanel>
</telerik:RadButton.Content>
</telerik:RadButton>
<TextBox Grid.Column="3"
Text="{Binding LongDisplayValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding Editable}"
Width="80"
Margin="5"
TextChanged="ShortValueTextbox_TextChanged"
KeyDown="SecondUIElement_OnKeyDown"
LostFocus="SecondUIElement_OnLostFocus" />
<telerik:RadButton Grid.Column="4"
Command="{Binding Path=DataContext.SetSinglePredictedLongCommand, ElementName=Grid}"
CommandParameter="{Binding}"
IsEnabled="{Binding Editable}"
Visibility="{Binding Visible}" HorizontalContentAlignment="Left"
Margin="2">
<telerik:RadButton.Content>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Label Background="{Binding ConfidenceBrush}" Foreground="{Binding ConfidenceForegroundBrush}" Height="20" Width="20" Content="{Binding ConfidenceCharacter}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Margin="0"></Label>
<TextBlock Text="{Binding LongButton}" />
</StackPanel>
</telerik:RadButton.Content>
</telerik:RadButton>
</Grid>
</DataTemplate>
</Grid.Resources>
<ItemsControl ItemTemplate="{StaticResource RowsTemplate}" ItemsSource="{Binding Rows}" />
</Grid>
</ScrollViewer>
</Grid>
<Border Grid.Row="2" BorderThickness="0, 1, 0, 0" Margin="0, 0, 0, 10" BorderBrush="LightGray" />
<Grid Grid.Row="3" HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="A" />
<ColumnDefinition SharedSizeGroup="A" />
<ColumnDefinition SharedSizeGroup="A" />
<ColumnDefinition SharedSizeGroup="A" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<telerik:RadButton Grid.Row="0" Grid.Column="0"
Content="{Binding SwapAllLocalisation}"
Click="SwapAllButton_OnClick"
IsEnabled="{Binding ScalesExist}"
HorizontalAlignment="Center"
Margin="2"/>
<telerik:RadButton Grid.Row="0" Grid.Column="1"
Content="{Binding SetAllPredictedLocalisation}"
Click="SetAllPredictedButton_OnClick"
IsEnabled="{Binding PredictionsAvailable}"
HorizontalAlignment="Center"
Margin="2"/>
<telerik:RadButton Grid.Row="0" Grid.Column="2"
Content="{Binding ResetLocalisation}"
Click="ResetButton_OnClick"
IsEnabled="{Binding ScalesExist}"
HorizontalAlignment="Center"
Margin="2"/>
<telerik:RadButton Grid.Row="0" Grid.Column="3"
Content="{Binding ArtworkRevisionsLocalisation}"
Click="ArtworkRevisionsButton_OnClick"
HorizontalAlignment="Center"
IsEnabled="{Binding ArtworksButtonEnabled}"
Visibility="{Binding ArtworksButtonVisible, Converter={ StaticResource BooleanToVisibilityHiddenOnFalseConverter}}"
Margin="2"/>
<telerik:RadButton Grid.Row="1" Grid.Column="0"
Content="{Binding ImportLocalisation}"
Click="ButtonImport_Click"
IsEnabled="{Binding ScalesExist}"
ContextMenu="{StaticResource ImportContextMenu}"
HorizontalAlignment="Center"
Margin="2"/>
<telerik:RadButton Grid.Row="1" Grid.Column="1"
Content="{Binding StackupImportLocalisation}"
Click="ButtonImportFromStackup_OnClick"
ContextMenu="{StaticResource ImportFromStackupContextMenu}"
IsEnabled="{Binding CanImportFromStackup}"
Visibility="{Binding ImportFromStackupEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"
HorizontalAlignment="Center"
Margin="2"/>
<ItemsControl Grid.Row="1" Grid.Column ="2" Grid.ColumnSpan="2" ItemsSource="{Binding ScalingImportExportMetaData.ScalingExportTypes}" ItemTemplate="{StaticResource ExportButtonTemplate}" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
<Grid Grid.Row="2" Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Grid.ColumnSpan="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="{Binding SingleCoresLocalisation}" VerticalAlignment="Center"/>
<RadioButton IsChecked="{Binding UseSingleCores}" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<TextBlock Text="{Binding IndividualCopperLocalisation}" VerticalAlignment="Center"/>
<RadioButton IsChecked="{Binding UseSingleCores, Converter={ StaticResource BooleanInvertConverter}}" VerticalAlignment="Center"/>
</StackPanel>
</Grid>
</Grid>
</Grid>
</ScrollViewer>
<Grid Grid.Column="1">
<Grid.Resources>
<converters:NonZeroDoubleToVisibilityConverter x:Key="NonZeroDoubleToVisibilityConverter" />
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition SharedSizeGroup="B"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition SharedSizeGroup="C"></RowDefinition>
<RowDefinition SharedSizeGroup="D"></RowDefinition>
</Grid.RowDefinitions>
<ScrollBar Grid.Row="1" Minimum="0" SmallChange="1" LargeChange="10"
ViewportSize="{Binding ViewportHeight, ElementName=ScrollViewer}"
Maximum="{Binding ScrollableHeight, ElementName=ScrollViewer}"
Scroll="ScrollBar_OnScroll" Name="ScrollBar"
Visibility="{Binding RelativeSource={RelativeSource Self}, Path=Maximum, Converter={StaticResource NonZeroDoubleToVisibilityConverter}}" />
</Grid>
</Grid>
</infrastructure:Plugin>
I have grid designed something like below:
This is xaml used for a grid:-
I am using devexpress gridcontrol in my application.
<dxg:GridControl ItemsSource="{Binding MyAddresses}">
<dxg:GridControl.View>
<dxg:TableView NavigationStyle="Cell"></dxg:TableView>
</dxg:GridControl.View>
<dxg:GridControl.Columns>
<dxg:GridColumn Name="MyAddress" Header="Address" MinWidth="725">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<Grid DataContext="{Binding RowData.Row}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="5"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="5"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="5"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="5"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="5"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="5"></ColumnDefinition>
<ColumnDefinition MinWidth="250"></ColumnDefinition>
<ColumnDefinition Width="25"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="5"></ColumnDefinition>
<ColumnDefinition MinWidth="250"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.RowSpan="3" Grid.Column="0" Text="Address"/>
<dxe:TextEdit Grid.Row="0" TextWrapping="Wrap" AcceptsReturn="True" VerticalContentAlignment="Top" Grid.RowSpan="3" Grid.Column="2" MaxLength="2000" VerticalAlignment="Stretch" Text="{Binding PostAddress}"/>
<TextBlock Grid.Row="6" Grid.Column="0" Text="Country" />
<dxe:TextEdit Grid.Row="6" Grid.Column="2" Text="{Binding PostCountry}"/>
<TextBlock Grid.Row="4" Grid.Column="0" Text="City" />
<dxe:TextEdit Grid.Row="4" Grid.Column="2" MaxLength="100" Text="{Binding City}"/>
<TextBlock Grid.Row="8" Grid.Column="0" Text="Postal Code" />
<dxe:TextEdit Grid.Row="8" Grid.Column="2" MaxLength="15" Text="{Binding PostalCode}"/>
<TextBlock Grid.Row="10" Grid.Column="0" Text="Subdivision" />
<dxe:TextEdit Grid.Row="10" Grid.Column="2" MaxLength="100" Text="{Binding Subdivision}"/>
<TextBlock Grid.Row="0" Grid.Column="4" Text="Email" />
<dxe:TextEdit Grid.Row="0" Grid.Column="6" MaxLength="254" Text="{Binding Email1}"/>
<TextBlock Grid.Row="2" Grid.Column="4" Text="Phone" />
<dxe:TextEdit Grid.Row="2" Grid.Column="6" MaxLength="20" Text="{Binding Phone1}"/>
<TextBlock Grid.Row="4" Grid.Column="4" Text="Phone" />
<dxe:TextEdit Grid.Row="4" Grid.Column="6" MaxLength="20" Text="{Binding Phone2}"/>
<TextBlock Grid.Row="6" Grid.Column="4" Text="Fax" />
<dxe:TextEdit Grid.Row="6" Grid.Column="6" MaxLength="50" Text="{Binding Fax1}"/>
<TextBlock Grid.Row="8" Grid.Column="4" Text="Telex" />
<dxe:TextEdit Grid.Row="8" Grid.Column="6" MaxLength="100" Text="{Binding Telex}"/>
<TextBlock Grid.Row="10" Grid.Column="4" Text="Web" />
<dxe:TextEdit Grid.Row="10" Grid.Column="6" MaxLength="255" Text="{Binding Web}"/>
</Grid>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
<dxg:GridColumn FieldName="NewField"/>
</dxg:GridControl.Columns>
</dxg:GridControl>
In first cell I have few columns, I want to move cursor with in first cell and then jump to second cell.
Can someone please help.
![enter image description here][1]
My grid looks like above. I have focus on first field . On pressing tab I want focus move to City field not to next cell which is New Field.
Any suggestions?
[1]: http://i.stack.imgur.com/ENqqP.png
The same issue is already discussed at DevExpress Support Center: Tabbing issue in CellTemplate. Thus, you can use the solution provided by the DevExpress Support Team.
The main idea of this solution is in custom handling of the TabbedView.PreviewKeyDown event:
void TableView_PreviewKeyDown(object sender, KeyEventArgs e) {
if (e.Key == Key.Tab) {
// do some custom handling
e.Handled = true; // avoid TabbedView's default focus processing
}
}
How to adjust the scrollviewer stick with windows side ? please refer to the diagrams have a clearer visual. The scrollbar will resize based on windows accordingly.
<ScrollViewer Height="600" HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<GroupBox Grid.Column="1" Header="A 1" HorizontalAlignment="Left" VerticalAlignment="Top">
<StackPanel Orientation="Vertical">
//GroupBox A
//GroupBox B
<StackPanel Orientation="Horizontal">
<GroupBox Header="C" Margin="0, 10, 0, 0" Width="600">
<Grid Margin="5, 0, 5, 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition Width="105" />
<ColumnDefinition Width="35" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="105" />
<ColumnDefinition Width="35" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="D" Margin="0, 10, 0, 0" HorizontalAlignment="Left" VerticalAlignment="Center" />
<TextBox Grid.Row="0" Grid.Column="1" Margin="0, 10, 0, 0" Height="25" />
<Button Grid.Row="0" Grid.Column="4" Grid.RowSpan="2" Content="Okay" Margin="0, 10, 0, 0" Width="90" Height="25" HorizontalAlignment="Left" />
</Grid>
</GroupBox>
</StackPanel>
</StackPanel>
</GroupBox>
</Grid>
</ScrollViewer>
Remove the HorizontalAlignment="Left" from the ScrollViewer in your XAML
I am implementing a headered table using grids above each other, so I can specify columns headers. There is one grid for headers, and one grid for every row in the table. It is not very practical, header widths has to be specified twice. Maybe I instead can have a ListView/DataGrid without all styling?
How can I get rid of this multi Grid approach?
Here is what I got:
<StackPanel Orientation="Vertical">
<Grid Margin="0, 10, 0, 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition Width="70" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0"
Text="header 1" />
<TextBlock Grid.Column="1" Grid.Row="0"
Text="header 2" />
</Grid>
<ItemsControl ItemsSource="{Binding Entities}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<Grid Margin="0, 10, 0, 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition Width="70" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0"
Text="{Binding Property1}" />
<TextBlock Grid.Column="1" Grid.Row="0"
Text="{Binding Property2}" />
</Grid>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
You can use Grid.IsSharedSizeScope attached property
<StackPanel Orientation="Vertical" Grid.IsSharedSizeScope="True">
<Grid Margin="0, 10, 0, 0">
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="First" Width="40" />
<ColumnDefinition SharedSizeGroup="Second" Width="70" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0"
Text="header 1" />
<TextBlock Grid.Column="1" Grid.Row="0"
Text="header 2" />
</Grid>
<ItemsControl ItemsSource="{Binding Entities}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<Grid Margin="0, 10, 0, 0">
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="First" />
<ColumnDefinition SharedSizeGroup="Second" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0"
Text="{Binding Property1}" />
<TextBlock Grid.Column="1" Grid.Row="0"
Text="{Binding Property2}" />
</Grid>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
This is my control with my custom DataTemplateSelector:
<m:Map x:Name="MainMap">
<m:MapItemsControl
ItemsSource="{Binding Source={StaticResource WorkLayerData}}">
<m:MapItemsControl.ItemTemplate>
<DataTemplate>
<Mobile:DevicePushpinTemplateSelector
m:MapLayer.Position="{Binding Location}"
ZoomLevel="{Binding ZoomLevel, ElementName=MainMap}"
Content="{Binding}">
<Mobile:DevicePushpinTemplateSelector.DotTemplate>
<DataTemplate>
<Ellipse Width="8" Height="8" Stroke="Black" Fill="{Binding IsGPSDataRecent, Converter={StaticResource BoolToGreenRedBrushConverter}}" StrokeThickness="1" />
</DataTemplate>
</Mobile:DevicePushpinTemplateSelector.DotTemplate>
<Mobile:DevicePushpinTemplateSelector.NumberedTemplate>
<DataTemplate>
<Border x:Name="border" Background="{Binding IsGPSDataRecent, Converter={StaticResource BoolToGreenRedBrushConverter}}" BorderBrush="Black" BorderThickness="2" Padding="2" Height="20" CornerRadius="8">
<TextBlock VerticalAlignment="Center" Text="{Binding DisplayId}" />
</Border>
</DataTemplate>
</Mobile:DevicePushpinTemplateSelector.NumberedTemplate>
<Mobile:DevicePushpinTemplateSelector.DetailedTemplate>
<DataTemplate>
<Border Background="{Binding IsGPSDataRecent, Converter={StaticResource BoolToGreenRedBrushConverter}}" BorderBrush="Black" BorderThickness="1" Padding="2" CornerRadius="2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="Id:" FontWeight="Bold" />
<TextBlock Text="{Binding DisplayId}" Grid.Column="1" />
<TextBlock Text="Device Id:" FontWeight="Bold" Grid.Row="1" />
<TextBlock Text="{Binding DeviceId}" Grid.Row="1" Grid.Column="1" />
<TextBlock Text="Speed:" FontWeight="Bold" Grid.Row="2" />
<TextBlock Text="{Binding Speed}" Grid.Row="2" Grid.Column="1" />
<TextBlock Text="Location:" FontWeight="Bold" Grid.Row="3" />
<TextBlock Text="{Binding Location}" Grid.Row="3" Grid.Column="1" />
<Button Content="View Details" Grid.Row="4" Grid.ColumnSpan="2" />
</Grid>
</Border>
</DataTemplate>
</Mobile:DevicePushpinTemplateSelector.DetailedTemplate>
</Mobile:DevicePushpinTemplateSelector>
</DataTemplate>
</m:MapItemsControl.ItemTemplate>
</m:MapItemsControl>
</m:Map>
I want to move my Mobile:DevicePushpinTemplateSelector.DetailedTemplate into resources so I can reuse it somewhere else.
I declared resource:
<UserControl.Resources>
<DataTemplate x:Key="DetailedMapItemTemplate">
<Border Background="{Binding IsGPSDataRecent, Converter={StaticResource BoolToGreenRedBrushConverter}}" BorderBrush="Black" BorderThickness="1" Padding="2" CornerRadius="2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="Id:" FontWeight="Bold" />
<TextBlock Text="{Binding DisplayId}" Grid.Column="1" />
<TextBlock Text="Device Id:" FontWeight="Bold" Grid.Row="1" />
<TextBlock Text="{Binding DeviceId}" Grid.Row="1" Grid.Column="1" />
<TextBlock Text="Speed:" FontWeight="Bold" Grid.Row="2" />
<TextBlock Text="{Binding Speed}" Grid.Row="2" Grid.Column="1" />
<TextBlock Text="Location:" FontWeight="Bold" Grid.Row="3" />
<TextBlock Text="{Binding Location}" Grid.Row="3" Grid.Column="1" />
<Button Content="View Details" Grid.Row="4" Grid.ColumnSpan="2" />
</Grid>
</Border>
</DataTemplate>
</UserControl.Resources>
My problem is that I don't know HOW to use this DataTemplate inside my selector. What is the XAML I need to use? With controls like ListBox it is easy, just set ItemTemplate="{StaticResource thisTemplate}" but how do I do this in my case? Still learning XAML
Just set the DetailedTemplate property in the tag itself:
<Mobile:DevicePushpinTemplateSelector
m:MapLayer.Position="{Binding Location}"
ZoomLevel="{Binding ZoomLevel, ElementName=MainMap}"
Content="{Binding}"
DetailedTemplate="{StaticResource DetailedMapItemTemplate}">
...