Is there any way to create a draggable textbox in WPF ? I can see lot of ways of creating draggable TextBlock in WPF. But can't find a similar way to achieve this for Textbox.
Normally a drag is started if the mouse is moved a few pixels while at least one mouse button is down. This "pattern" also appears when selecting text in a textbox. It seems there will be no way to tell this actions apart, so this might be the reason there is no "movable textbox" designed this way.
As a possible way to solve your problem you could take this approach into account: Universally usable editable label
Alternatively you could add some area to your textbox, which reacts to moving.
<StackPanel Orientation="Horizontal">
<Rectangle x:Name="DraggablePart" .../>
<TextBox .../>
</StackPanel>
Or even some kind of adorner, which will appear only, when the textbox is hovered.
Related
So what is the best method to get vertical radio buttons to display in situations with limited screen space. I started with the standard xp:radioGroup, but I can't control the format to be vertical.
I have tried the multicolumnradiobutton on OpenNTF, but I was having problems getting an eventHandler to fire to force a partial refresh (tried using onclick). Would love to see a sample of that since that would solve the issue of formatting.
What I am seeing at this point is if you use a radiobutton group you are stuck with a horizontal layout of buttons. I haven't looked Dojo Radio Button to see if it was the answer.
Basically best option for vertical list of radio buttons that will allow partialRefresh of document.
You get vertical radio buttons with xp:radioGroup when you set layout="pageDirection":
<xp:radioGroup
id="radioGroup1"
value="..."
layout="pageDirection">
...
</xp:radioGroup>
You can use a radio button (not a group) and tie them together with the name. Then you can format them any way you want. This is useful when using Bootstrap since the radio button group puts everything in a table.
So is there a way to stop scrolling up ?
I have listview's scrollview and i tryed saving last position and in listview size changed scroll down - but it first scrolls down and later up ;/ Maybe there is some different event or completly different way ?
You can set the ItemsStackPanel's ItemUpdatingScrollMode.
<ListView>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel ItemsUpdatingScrollMode="KeepScrollOffset" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
It only works when the scroll offset is greater than 0, so just scroll using ChangeView() to set it up.
I'm working on universal app. When I'm designing the view for Windows Phone 8.1 project, I can't make any button's width smaller than 109. If I set the button's width property to smaller than that, it becomes 109 when rendered.
I would like to know how to force the button to be smaller than that, and why does this limitation exists in the first place.
Thanks a lot for helping!
If you are just dragging the button from the Toolbox, it will set a MinWidth and MinHeight for you. You need to change these properties.
<Button MinWidth="25" MinHeight="50" />
I'm having a bit of trouble with custom action buttons in the honeycomb+ action bar. I'm adding a menu item that uses a custom layout (using the android:actionLayout attribute). The reason for the custom layout is that I want a button that has two lines of text that can be updated dynamically.
However, I still want this action button to operate like the other standard buttons. By this I mean that the background fades in when the button is selected, and fades out again if it is unselected, all in the style of the platform (the colour seems to differ between different platforms/devices - I've seen both grey and blue versions)
I've tried using the action button style for the custom layout:
style="#android:style/Widget.ActionButton"
and I've tried setting the background for the custom layout to:
android:background="?android:attr/actionBarItemBackground"
but to no avail, and I'm kind of trying things fairly randomly as I can't find any documentation on how to do this (or if indeed it is even possible).
I know I can approximate this behaviour myself by setting the background, but it would be nice if I could just set the item to behave like a normal action button in terms of how it appears when the user interacts with it.
Anyone have any ideas?
Thanks in advance!
Ah, sorry to answer my own question but I have just stumbled upon a way to do this. I was halfway there - you need your custom layout's style to inherit from ActionButton:
#android:style/Widget.ActionButton
but then you also need to make the layout clickable:
android:clickable="true"
for it to work. Using both of these makes the custom action buttons look just like the regular ones when you press them.
Hopefully that'll help someone trying to do this!
I am using Windows Performance suite (which part of Microsoft Windows SDK) to profile my sample application. I am using the "Perforator" with an option "Show dirty-region update overlay", which enables me to see when and where areas are redrawn in an application.
When I hover mouse over a TextBox control then I see that it is redrawn multiple times and the CPU utilization goes up. I tested with a very simple window with just a TextBox control and a button control.
Is this normal for WPF to redraw control on mouse hover?
Is there anything that I can do to minimize this?
Here is the windows that I am using
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<StackPanel Orientation="Horizontal">
<TextBox Height="25" Width="150" >
</TextBox>
<Button Margin="10,0,0,0" Height="25">1211</Button>
</StackPanel>
</Grid>
Its not "normal" for WPF to redraw the control on mouse over, because WPF only updates the region that has changed (using retained mode graphics):
One of the biggest benefits in using retained mode graphics is that
WPF can efficiently optimize what needs to be redrawn in the
application. Even if you have a complex scene with varying levels of
opacity, you generally do not need to write special-purpose code to
optimize redrawing (see Intelligent Redrawing in the Retained Mode Graphics section).
The problem in this case is that the active Windows theme is applied to the controls. When you move the mouse over the button, you'll see that the button slightly changes to a "light blue-transparent" color (though this depends upon your active Windows theme). At the same time, once you focus the button, another "animative" type of behavior is applied to the button. You can clearly see this with the dirty-region checked.
If you want to change this, you need to define your own theme, overriding the default-theme-behavior. Here's a post to get you started.