I'm developing a windows phone 8 application.
I've got a textblock with a price in it.
Only thing I want to do is a line through the textblock.
I've tried to use the Line function but that one doesn't work because the textblock has a variable length.
Does anyone know how I can make this happen?
This worked for me thanks to Chkon for giving me the answer in this thread:
<Grid HorizontalAlignment="Left" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Some text" VerticalAlignment="Top" Grid.RowSpan="2"/>
<Border BorderThickness="0,0,0,1" BorderBrush="#FF949494" >
</Border>
</Grid>
Related
I want to develop app which is targeting to Multi resolution Device i Windows Phone(i.e. : 480*800 to 1080*1920)
this is my code for list box
<ListBox x:Name="LstContact">
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderBrush="#cbc6c0"
BorderThickness="0,0,0,2"
Margin="10">
<Grid >
<TextBlock Text="{Binding FirstName}"
Foreground="Black"
FontSize="22"
Margin="10" />
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
And output should be like this
please help to that
It is Silverlight, so just put something like Width="480" to your Border and you are done.
I'm developing an app on Windows Phone 8, but when I select data from the Web service, it's cutting.
This is my code:
<Grid Background="Aqua">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
</StackPanel>
<ScrollViewer Grid.Row="1" Background="Yellow" >
<ItemsControl>
<TextBlock Grid.Row="1" Foreground="Black" x:Name="tbIcerik" TextWrapping="Wrap" Text="{Binding Icerik}" Style="{StaticResource PhoneTextNormalStyle}">
</TextBlock>
</ItemsControl>
</ScrollViewer>
<!--ContentPanel - place additional content here-->
</Grid>
Can someone please tell me what I'm doing wrong?
Please try adding a margin to the Textblock control
Mehmet,
If you are new to the Windows Mobility Designing Please go through this link. Its very simple to understand
https://msdn.microsoft.com/en-us/library/windows/apps/jj207025%28v=vs.105%29.aspx
After that You can go through Metro Design Guidelines as well.
Thanks
The text block has a limitation of how many characters it can print. If the data you are getting is very huge , there are chances that when you scroll down , other parts of data is being truncated !
Let me know the response you are getting so that I can assist you further
Add Margin to your TextBlock name tbIcerik i.e Margin="10,0,0,10". This will leave equal space in front and back.
I have a slider within a user control. When testing it out, the slider won't move if it is kept within the user control but works outside of it. Is there something that's needed to make it work?
The XAML for the usercontrol:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="4,0,3,0" Grid.RowSpan="1">
<TextBlock Text="15 mins" VerticalAlignment="Center" FontSize="16" Margin="0,-11,0,0" TextLineBounds="Tight" Foreground="White"/>
<Slider Foreground="White" SmallChange="50" TickFrequency="50" LargeChange="50" Background="#BFFFFFFF" Value="50" Margin="5,0" VerticalAlignment="Center" Width="250" StepFrequency="50" Maximum="100" ValueChanged="Slider_ValueChanged"/>
<TextBlock Text="1 hour" VerticalAlignment="Center" FontSize="16" Margin="0,-11,0,0" TextLineBounds="Tight" Foreground="White"/>
</StackPanel>
<ListBox x:Name="TimesList" DataContext="{Binding}" Background="{x:Null}" Foreground="White">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="365" DataContext="{Binding}">
<TextBlock Foreground="White" Text="{Binding}" HorizontalAlignment="Stretch" FontSize="29.333"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Border Grid.RowSpan="2" BorderBrush="#B2FFFFFF" BorderThickness="2,0,2,2" Padding="0" Margin="-5,0,-5,-5"/>
</Grid>
I found that 60 pixels height is not enough for Slider control. That's why it doesn't work. But there are few easy ways to fix it. You can choose whatever fits your needs.
Option 1
Change the first row definition height to Auto. So the Grid will as high as the Slider control. It's 84 pixels.
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
Option 2
The way you use Grid layout makes it pretty much the same as StackPanel. So you could also replace this Grid with StackPanel.
Option 3
You na change Sldier's margins to fit 60 pixels height. Set the bottom margin to -24.
<Slider Foreground="White" SmallChange="50" TickFrequency="50" LargeChange="50" Background="#BFFFFFFF" Value="50" Margin="5,0,5,-24" VerticalAlignment="Center" Width="250" StepFrequency="50" Maximum="100" ValueChanged="Slider_ValueChanged"/>
I am Developing windows phone app. I want to ask how to create multi column list box. where data coming dynamically.
e.g: colg name Adress website
branches subjects and so on...
in xaml.cs i added
then how to displya it in multiple columns in list box
Just add a grid layout with three columns inside ListBox Datatemplate. Here is the example.
<ListBox Grid.Row="1" Name="listBoxHistory">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="480" Background="#e6e6e6" Margin="0,10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding emailid}"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding dob}"/>
<TextBlock Grid.Row="0" Grid.Column="2" Text="{Binding andsoon}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
I have a LongListMultiSelector with list items of a larger font-size. Due to this font change, I realized the check-box is always out of alignment to the actual list item. I've tried changing the horizontal and vertical alignment at every level and also adjusted padding and margin values. These change the text-block inside the list item but the check-box stays rooted to the top, and it gives a distorted look to the list.
Is there anyway to have the check-boxes centered vertically or manage its padding? I realized there recent post about margins to the list style, however it seemed rather involved without any straight input to my problem.
I found the solution. You can change margin for grid in datatemplate like this Margin="0,-15,0,22" - in my case top edge of checkbox will be parallel to the top edge of the text.
Hope it will help you.
<toolkit:LongListMultiSelector x:Name="SelectedPlayListLLS" ItemsSource="{Binding PlayListTracsObservationCollection}" LayoutMode="List" toolkit:TiltEffect.IsTiltEnabled="True"> <toolkit:LongListMultiSelector.ItemTemplate>
<DataTemplate>
<Grid Background="Transparent" Margin="0,-15,0,22">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="36" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image x:Name="image"
Width="36"
Height="36"
Source="{Binding Image}" VerticalAlignment="Top" Margin="0,15,0,0"/>
<StackPanel Grid.Column="1">
<TextBlock Text="{Binding Title}"
TextTrimming="WordEllipsis"
Margin="12,0,0,0"/>
<TextBlock Text="{Binding Name}"
TextTrimming="WordEllipsis"
Margin="12,0,0,0" Foreground="#99FFFFFF"/>
</StackPanel>
</Grid>
</DataTemplate>
</toolkit:LongListMultiSelector.ItemTemplate>
</toolkit:LongListMultiSelector>
You could always try putting the checkbox and textblock inside a StackPanel together. From that point you can adjust alignment of the checkbox.
Try something like this:
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<CheckBox VerticalAlignment="Top" IsChecked="{Binding Selected}" />
<TextBlock Text="{Binding DisplayName}" FontSize="40"/>
</StackPanel>