小编Tom*_*Tom的帖子

scrollviewer的子元素阻止滚动鼠标滚轮?

我在使用鼠标滚轮在以下XAML中工作时遇到问题,为简化起见,我已简化了这一点:

<ScrollViewer
HorizontalScrollBarVisibility="Visible"
VerticalScrollBarVisibility="Visible"
CanContentScroll="False"
>
    <Grid
    MouseDown="Editor_MouseDown"
    MouseUp="Editor_MouseUp"
    MouseMove="Editor_MouseMove"
    Focusable="False"
    >
        <Grid.Resources>
            <DataTemplate
            DataType="{x:Type local:DataFieldModel}"
            >
                <Grid
                Margin="0,2,2,2"
                >
                    <TextBox
                    Cursor="IBeam"
                    MouseDown="TextBox_MouseDown"
                    MouseUp="TextBox_MouseUp"
                    MouseMove="TextBox_MouseMove"
                    />
                </Grid>
            </DataTemplate>
        </Grid.Resources>
        <ListBox
        x:Name="DataFieldListBox"
        ItemsSource="{Binding GetDataFields}"
        SelectionMode="Extended"
        Background="Transparent"
        Focusable="False"
        >
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <Canvas />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemContainerStyle>
                <Style
                TargetType="ListBoxItem"
                >
                    <Setter
                    Property="Canvas.Left"
                    Value="{Binding dfX}"
                    />
                    <Setter
                    Property="Canvas.Top"
                    Value="{Binding dfY}"
                    />
                </Style>
            </ListBox.ItemContainerStyle>
        </ListBox>
    </Grid>
</ScrollViewer>
Run Code Online (Sandbox Code Playgroud)

在视觉上,结果是一些已知大小的区域,其中DataField从集合中读取的s可以用TextBox具有任意位置,大小等的es 来表示.如果ListBox"样式"区域"太大而无法一次显示",则可以进行水平和垂直滚动,但只能使用滚动条.

为了更好的人体工程学和理智,鼠标滚轮应该是可能的,并且通常ScrollViewer会自动处理它,但ListBox似乎是处理这些事件,使父母ScrollViewer永远不会看到它们.到目前为止,我只能够得到滚轮滚动的工作是设定IsHitTestVisible=False为无论是ListBox …

wpf listbox event-handling mousewheel scrollviewer

30
推荐指数
3
解决办法
2万
查看次数

等待CLGeocoder.GeocodeAddressAsync永远不会返回

我正在尝试测试Apple的前向地理编码服务的准确性,以涵盖我们的数据模型上的纬度/经度缺失或无效的罕见情况,但我们仍然知道物理地址.MonoTouch的提供CLGeocoder.GeocodeAddress(String, CLGeocodeCompletionHandler)以及GeocodeAddressAsync(String)但是当我打电话给他们的completionHandler不会被调用和异步方法永远不会返回.

我的应用程序日志中没有任何内容表明存在问题,并且将调用封装在try-catch块中并未显示任何异常.在项目选项中启用了地图集成.没有捕获网络流量(无论如何可能是SSL)我没有想法.

这是加载地标并尝试地理编码地址的代码:

    private void ReloadPlacemarks()
    {
        // list to hold any placemarks which come back with empty/invalid coordinates
        List<ServiceCallWrapper> geoList = new List<ServiceCallWrapper> ();

        mapView.ClearPlacemarks ();

        List<MKPlacemark> placemarks = new List<MKPlacemark>();
        if (serviceCallViewModel.ActiveServiceCall != null) {
            var serviceCall = serviceCallViewModel.ActiveServiceCall;
            if (serviceCall.dblLatitude != 0 && serviceCall.dblLongitude != 0) {
                placemarks.Add (serviceCall.ToPlacemark ());
            } else {
                // add it to the geocode list
                geoList.Add (serviceCall);
            }
        }

        foreach (var serviceCall in serviceCallViewModel.ServiceCalls) {
            if (serviceCall.dblLatitude …
Run Code Online (Sandbox Code Playgroud)

c# core-location xamarin.ios async-await xamarin

1
推荐指数
1
解决办法
597
查看次数