Is it possible to implement the ScrollToHorizontalOffset () function in XAML? (for dynamic list)

Here's the problem: I have a list of data-bound items, basically a way for users to match a response request. The response is an xml based file. I let them queue them, so I used combo boxes for answers. The answers will include the full path, so they will get a little time. I want the displayed combobox text to be validated so that the user can see the file name. For my static controls, I just use ScrollToHorizontalOffset () when the file is uploaded and I am done. For this dynamic list, I would like to do this in xaml.

A “ugly” solution would be to store all ComboBox objects at boot time ... then I can directly call ScrollToHorizontalOffset (), but I would prefer to do it in a cleaner way! EDIT: (Actually, this may be unreasonable. A quick look at trying to crack this problem gets into some really uncomfortable situations, trying to match the elements of my data source with the controls)

I tried HorizontalContentAlignment, which only affects the “drop down” part of the ComboBox.

I also tried hooking up various other loading events, but didn't find what works.

+3
source share
1 answer

, , . . .

<ComboBox x:Name="ConfigurationComboBox" VerticalContentAlignment="Center"  ToolTip="saved configuration" SelectionChanged="ConfigurationComboBox_SelectionChanged">
        <ComboBox.ItemTemplate>
           <DataTemplate >
               <StackPanel>
                  <TextBlock Text="{Binding}" ToolTip="{Binding Path}"></TextBlock>
               </StackPanel>
            </DataTemplate>
        </ComboBox.ItemTemplate>
    </ComboBox>

, . WPF.

+1

All Articles