c#


UWP Listview with itemswrapgrid setting width based on items content


I have an Listview with togglebuttons in datatemplate in UWP. I have configured the listview as itemwrapgrid. I am trying to assign diffrent width for items based on toggle buttons content length. Can anyone help me to do this.
<ListView x:Name="lstVw1" IsMultiSelectCheckBoxEnabled="True" Margin="0,20,0,0">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid Orientation="Horizontal" Width="Auto" HorizontalAlignment="Stretch"></ItemsWrapGrid>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<ToggleButton Style="{StaticResource ButtonStyle}" Content="{Binding ItemText}" Click="ToggleButton_Click">
</ToggleButton>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<ContentPresenter Padding="5"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
</ListView>
The above xaml gives equaly sized toggle buttons in the list

Related Links

How to control(access) the streams of TcpClients within the threads [closed]
Collision in Unity3d in an intervall?
Does NServiceBus v5.0 require performance counters?
Sleep until file exists/created
Errors with new MVC5 project in Visual Studio 2013.3
C# TableLayout doubling in height when adding rows?
Real time communication and debugging between Matlab and Visual Studio C# .NET
My service doesn't get my mocked DbContext through its constructor
WPF Canvas as a math graphing area
jQuery post to c# without form
Accessing Navigation Properties from IdentityUser when LazyLoading is off
Entity framwork - left join or something simalar
Returning jSON with Partial View HTML Snippet to add to the DOM
NodaTime TypeInitializationException Device Only, Release Only
How to keep proper aspect ratio of my application on widescreen monitor?
Hide sqlcmd in c# application

Categories

HOME
gulp
ckan
indexing
ns2
pyspark
locale
jenkins-pipeline
liquibase
highmaps
boxplot
stdout
browser-cache
aggregation-framework
multipartform-data
open-search-server
markdown
mamp
distinct
android-notifications
jinja2
minimum
console-application
luis
dompdf
simd
django-rest-auth
formulas
inline-assembly
pumping-lemma
ps
inspec
smart-device
formtastic
exacttarget
ibm-bpm
mplab
webmock
intersection
hippocms
multi-user
dotnetnuke-module
tapply
compiled-query
pyexcel
uitextview
test-kitchen
risc
infovis
stream-socket-client
stanford-nlp-server
px4
bioperl
photoshop-script
node-java
multi-select
lightspeed
sqlproj
spring-social-twitter
addressbook
normalisation
objectify
cexception
custom-build-step
calc
ios8-share-extension
angular-promise
jcomponent
gitk
tokudb
pdcurses
log-analysis
tinymce-plugins
service-broker
drools-guvnor
nsurlrequest
yosemite
breeze-sharp
pnunit
livescript
slimscroll
codio
autofilter
android-library
google-checkout
system.transactions
cron4j
motordriver
waveout
diazo
cherokee
chars
google-local-search
numerical-computing
authkit
onresize
managed-code

Resources

Encrypt Message