Forums

ItemsControl Height Binding
Last Post 02 Aug 2016 10:15 PM by Filip Dušek. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Bernd SUser is Offline
New Member
New Member
Posts:1


--
02 Aug 2016 08:08 AM
    Hi,

    the Binding -> Height="{Binding ButtonHeight}" <- does not work.
    If I set an explicit value like 144 the height is ok but if I use the binding, the ToggleButton is far to big.

    Is this supported? I try to scale Button sizes with the DPI of the device. So the Image is 48x48 pixel on 96 DPI and 96x96 on 192 DPI etc.

    Regards
    Bernd


    <ItemsControl ItemsSource="{Binding UnitRoster}">
    <ItemsControl.ItemsPanel>
    <ItemsPanelTemplate>
    <WrapPanel />
    </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <ItemsControl.ItemTemplate>
    <DataTemplate>
    <StackPanel Margin="5" >
    <TextBlock Text="{Binding Name}" />
    <ToggleButton Margin="1" Command="{Binding ViewModel.PlaceUnitCommand}" CommandParameter="{Binding Name}" IsChecked="{Binding IsChecked, Mode=TwoWay}" IsEnabled="{Binding Enabled}" Height="{Binding ButtonHeight}">
    <Image HorizontalAlignment="Center" Opacity="{Binding Opacity}" Source="{Binding Image}" />
    </ToggleButton>
    </StackPanel>
    </DataTemplate>
    </ItemsControl.ItemTemplate>
    </ItemsControl>
    Filip DušekUser is Offline
    Advanced Member
    Advanced Member
    Posts:669


    --
    02 Aug 2016 10:15 PM
    Hi, thanks for posting. I will check that out.
    You are not authorized to post a reply.