I have a data grid in which I need to freeze the rightmost column. It is no problem to freeze the columns from left to right with the FrozenColumnCount property.
Does anyone of you know how to do this??
i m in trouble some one please help me
It can be done with Columns of starting.
It can not be done for last columns.
<sdk:DataGridTemplateColumn Width="50" CellStyle="{StaticResource CenterAllignmentCell}">
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate >
<Button x:Name="btnDelete" Width="16" Height="16" Cursor="Hand" Content="Delete" Margin="0,0,0,0" Command="{Binding DeleteCommand,Source={StaticResource AlertListViewModel}}"
CommandParameter="{Binding AlertId}" HorizontalAlignment="Center" IsEnabled="{Binding IsDeleteRight,Source={StaticResource AlertListViewModel}}">
<Button.Template>
<ControlTemplate>
<Image Width="16" Height="16" Source="/TFM;component/Images/ic-delete.png" ToolTipService.ToolTip="Delete"/>
</ControlTemplate>
</Button.Template>
</Button>
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>
</sdk:DataGrid.Columns>
With the standard DataGrid the answer is no. See my previous response to the same question:
Freeze Columns from right to left
Related
I have two buttons on either side of a Label.
If either of these Buttons get removed, I want the Label to stay centered in a fixed position.
Is there any way to lock the position of this Label?
<DockPanel LastChildFill="True">
<DockPanel DockPanel.Dock="Top" Margin="4,8,4,8" LastChildFill="True">
<Button Name="SearchBackButton" Style="{DynamicResourceInfoButtonStyle}" Content="{StaticResource SearchBackButton}"
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,0,0" BorderBrush="Transparent" Background="Transparent" DockPanel.Dock="Left" Click="SearchBackButton_Click" />
<Label HorizontalAlignment="Center" FontFamily="HelveticaNeue" FontSize="14" FontStyle="Normal" FontWeight="SemiBold" Foreground="#273238" Name="SuggestedTemplatesText" Content="{x:Static res:UIStrings.SuggestedTemplates}"/>
<Button Name="info_icon" Style="{DynamicResource InfoButtonStyle}" Click="InfoButton_Click"
VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" BorderBrush="Transparent" Background="Transparent" DockPanel.Dock="Right"/>
</DockPanel>
</DockPanel> <!-- Added by edit -->
This is the code for the Label and the two Buttons.
I have a pivot most used in the desktop and I want the arrows in the pivots to be fixed and not just to appear on hover and also to make the arrows larger(double) as they can be easily clicked.
I tried to find the parameter in the style component but unfortunately didn't have much luck there.
This is the default style for the Pivot element. https://msdn.microsoft.com/en-in/library/windows/apps/mt299144.aspx . Please update your required attribute to achieve the same. I updated height of the left and right navigation buttons(PreviousButton & NextButton) and thus it is reflecting in the UI
Here is the specific portion changes did in the default template:
<Button
x:Name="PreviousButton"
Grid.Column="1"
Template="{StaticResource PreviousTemplate}"
Width="20"
Height="72"
UseSystemFocusVisuals="False"
Margin="{ThemeResource PivotNavButtonMargin}"
IsTabStop="False"
IsEnabled="True"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Opacity="1"
Background="Transparent" />
<Button
x:Name="NextButton"
Grid.Column="1"
Template="{StaticResource NextTemplate}"
Width="20"
Height="72"
UseSystemFocusVisuals="False"
Margin="{ThemeResource PivotNavButtonMargin}"
IsTabStop="False"
IsEnabled="True"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Opacity="1"
Background="Transparent" />
<ContentControl Width="120">
<ContentControl.Content>
<ContentControl>
<ContentControl.ContentTemplate>
<DataTemplate>
<TextBlock Text="ABC" TextAlignment="Right" HorizontalAlignment="Right"/>
</DataTemplate>
</ContentControl.ContentTemplate>
</ContentControl>
</ContentControl.Content>
Please find the above code.
It's not getting right aligned.
It is working, but ContentControl by default aligns it's content to the left with just enough place to show.
You can just set HorizontalContentAlignment to Right in ContentControl, so child don't have to worry about it:
<ContentControl Width="120" HorizontalContentAlignment="Right">
<TextBlock Text="ABC" />
</ContentControl>
Or you can set HorizontalContentAlignment to Stretch and leave the rest for child to figure out:
<ContentControl Width="120" HorizontalContentAlignment="Stretch">
<TextBlock Text="ABC" HorizontalAlignment="Right" />
</ContentControl>
I have a strange issue, I tried every trick I knew to centre align the ListView placed inside a grid. No matter what, it looks like it is left aligned. The width and height of the ListView is data bound. (Width can take values 350 or 700 and height can take 100 or 200 depending on the Size settings. If size settings is compact it should be 350x100 and and if normal 700x200).
This is the xaml code
<Grid x:Name="GridPageLVPortrait" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" Background="Beige" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,0,584.714,0" Width="781">
<ListView x:Name="PageLVPortrait" ItemsSource="{Binding}" CanReorderItems="True" AllowDrop="True" HorizontalAlignment="Center" SelectionMode="Single" IsSwipeEnabled="True" IsItemClickEnabled="True" SelectionChanged="PageLVPortraitSelectionChanged" ItemClick="PageLVPortraitItemClick" Height="{Binding TemplateHeight}" Width="{Binding TemplateWidth}" >
<ListView.ItemTemplate>
<DataTemplate>
<Canvas HorizontalAlignment="Center" Width="{Binding TemplateWidth}" Height="{Binding TemplateHeight}">
<Canvas.Background>
<ImageBrush ImageSource="{Binding PageBackground}"/>
</Canvas.Background>
<Image HorizontalAlignment="Center" Height="{Binding TemplateHeight}" Width="{Binding TemplateWidth}" Source="{Binding Page}" Stretch="None" Opacity="1" CacheMode="BitmapCache" />
<StackPanel x:Name="EditDeleteStackPanel" Width="{Binding TemplateWidth}" Height="{Binding TemplateHeight}" Opacity="0.95">
<Button x:Name="NoteDelete" HorizontalAlignment="Right" VerticalAlignment="Top" Foreground="{x:Null}" Tapped="NoteDelete_Tapped" MinWidth="50" MinHeight="50" Margin="0,0,10,0" BorderBrush="{x:Null}" >
<Button.Background>
<ImageBrush ImageSource="{Binding Delete}"/>
</Button.Background>
</Button>
<Button x:Name="NoteEdit" HorizontalAlignment="Right" VerticalAlignment="Top" FontFamily="Segoe Script" FontSize="24" BorderBrush="{x:Null}" Tapped="NoteEdit_Tapped" Foreground="{x:Null}" MinWidth="50" MinHeight="50" Margin="0,0,10,0">
<Button.Background>
<ImageBrush ImageSource="{Binding Edit}"/>
</Button.Background>
</Button>
</StackPanel>
</Canvas>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
Could someone kindly help?
I've tried your code, in a whole page Grid with the normal dimension convention you provided (700x200). The listview does get center aligned if I ignore the grid's Margin="0,0,584.714,0". If you need the 584px in the right of the page, I'd say better put a grid's column there with that width.
I had found the issue. It is because the main grid is spit into 4 columns. And since this one uses columnspan, the alignment gets messed up.
Please let me know how i can hide the scrollbar from being displayed in Silverlight.
I dont want vertical or horizontal scrollbar. i want to hide both . PLease help
You can set the ScrollViewer.HorizontalScrollBarVisibility and/or ScrollViewer.VerticalScrollBarVisibility attached properties to "Disabled". For example, if you have the following XAML:
<ListBox Height="100" Name="listBox1" Width="100">
<ListBoxItem>
<Rectangle Width="200" Height="50" Fill="#FF894220" />
</ListBoxItem>
<ListBoxItem>
<Rectangle Width="200" Height="50" Fill="#FFB94222" />
</ListBoxItem>
</ListBox>
You will therefore get scrollbars, like so:
[Unfortunately StackOverflow won't let me post the images until I get a higher reputation (which I'm trying to build). You'll have to imagine it or try it yourself]
Adding the ScrollViewer attached properties to the ListBox element:
<ListBox Height="100" Name="listBox1" Width="100"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBoxItem>
<Rectangle Width="200" Height="50" Fill="#FF894220" />
</ListBoxItem>
<ListBoxItem>
<Rectangle Width="200" Height="50" Fill="#FFB94222" />
</ListBoxItem>
</ListBox>
results in no scrollbars.
Hope this helps...
Chris