I need to draw a line with plusses along an given path (arch) but can't seem to find anything pointing me in the right direction.
Any help would me much appreciated.
Best,
Jon H
So I have a string like Русское Имя how to represent it as real string with wcf textBox? And How to encode for example russian string inputed into textInput into UTF-8?
Hello!
I need to define a user control in runtime and then instantiate it wherever I want. So it should not be just a "new UserControl()" (that will be an instance of a UserControl class) but the one I can use as a template. Should I use reflection to generate new type or is there a better way?
Thanks!
struct Drink
{
public string Name { get; private set; }
public int Popularity { get; private set; }
public Drink ( string name, int popularity )
: this ( )
{
this.Name = name;
this.Popularity = popularity;
}
}
List<Drink> coldDrinks = new List<Drink> ( ){
new Drink ( "Water", 1 ),
new Drink ( "Fanta", 2 ),
new Drink ( "Sprite", 3 ),
new Drink ( "Coke", 4 ),
new Drink ( "Milk", 5 ) };
}
}
So that I can see the Name property for treeview item names.
I'm building a custom Silverlight UserControl which needs to listen to events using Preview/Tunneling, but for some reason the compiler is telling me they are not recognized or accessible.
For example, I can add an event handler to MouseLeftButtonDown, but not PreviewMouseLeftButtonDown. This doesn't make sense because according to Microsoft (http://msdn.microsoft.com/en-us/library/system.windows.uielement_members(v=VS.100).aspx) all UIElements should have Preview events attached.
Any ideas as to why this is happening? I'm using Visual Studio 2010 Trial, Blend 4 RC and .Net 4, if that makes a difference.
Let's say we have a text field named TXTBLAH and a setting named SETTINGBLAH
Is there anyway to write in XAML markup that whenever the text field BLAH gets updated to write that to the registry, and also when the form loads is there a XAML binding to restore it?
The following xaml looks fine in XP, but the bottom of the text gets cut off in Vista and Windows 7.
<Grid>
<Border Height="86"
Margin="10,54,10,0"
VerticalAlignment="Top"
BorderBrush="Black"
BorderThickness="1"/>
<Label Height="22"
Width="100"
Margin="15,43,0,0"
VerticalAlignment="Top"
HorizontalAlignment="Left"
Background="White">Text Over Border</Label>
</Grid>
I realize that I could just increase the Height of the label, but I'm guessing I'll have problems with systems that have different resolution settings, or large text settings. Is there a better way to lay this out?
Hi
There is a list box with some items in it. Also there is a grid with 3x3 matrix. The user will be dragging an item and dropping on one the cells of grid.
Most of the samples I found are about dragging-dropping from one listbox to another listbox. But I want to drop in one cell of grid. How can I achieve this?
Please advise. thanks
PJ
TextChangedEventArgs is being fired twice in my RichTextBox control.
Is this normal?
Also, when will e.Changes (you know the TextChangedEventArgs) be 1. The only case I can think of is someone pasting content into it.
But other times it seems in normal typing a person can really only change 1 paragraph right?
Hello,
I have several UserControls that have some of the same controls doing the same job.
Is it possible to extract those controls into a base class?
When I have tried it, I get an error that the definition in the generated .g.cs file will hide the parent def.
What I would like to do:
public class ctlBase : UserControl
{
internal CheckBox chkBox { get; set; }
}
In the .xaml of the derived class:
<Grid>
<CheckBox x:Name="chkBox" />
</Grid>
public class DerivedCtl : ctlBase
{ }
Thanks for any insights...
I want to position a modal dialog (progress window) at the top right corner of the parent window client area.
This code will put it in the corner of the non-client area, but how do I calculate the offset to the client area?
this.Owner=owner;
this.Left=owner.Left+owner.ActualWidth-Width;
this.Top=owner.Top;
Edit:
I found this 'solution' that works for normal windows:
this.Left=owner.Left+owner.ActualWidth-Width-SystemParameters.ResizeFrameVerticalBorderWidth;
this.Top=owner.Top+SystemParameters.ResizeFrameHorizontalBorderHeight+SystemParameters.WindowCaptionHeight;
This would however fail for windows that have customized borders.
EDIT:
The code should work regardless of the systems DPI setting (e.g. 120 instead of 96).
I want an Expander that only expands/collapse it's content when the user clicks on the header icon. (Instead of the whole header being clickable.)
Do I have to redefine the control Template to do this? How would it look like?
Where can I find the standard templates/styles for controls?
Thanks for your time.
I'm building a special listbox control that our designers want customized in some tweaky ways.
One thing they want to see is that the middle button-drag does what the left button-drag normally does (we are repurposing left-drag to other things).
So it needs the two key features that left-drag does in a ListBox default implementation:
While holding down the button and dragging, the selection starts where I click down and extends to where I drag.
While dragging outside the listbox region, it scrolls if there is scrollable space in that direction.
Before I go an duplicate this functionality by hand, is there any easy way to fool ListBox into thinking it's getting left-mouse drag events but instead is getting middle-mouse?
I'm building a simple hex editor in C#, and I've decided to use each cell in a DataGrid to display a byte*. I know that DataGrid will take a list and display each object in the list as a row, and each of that object's properties as columns. I want to display rows of 16 bytes each, which will require a wrapper with 16 string properties. While doable, it's not the most elegant solution. Is there an easier way? I've already tried creating a wrapper around a public string array of size 16, but that doesn't seem to work.
Thanks
*The rational for this is that I can have spaces between each byte without having to strip them all out when I want to save my edited file. Also it seems like it'll be easier to label the rows and columns.
Can someone explain this XAML statement, particularly what is the Resolve?
<MenuItem Header="_Load File" Command="{Resolve {Type Commands:LoadFile}}" />
In the program I am trying to build, I have a menu button that opens a second window. The user puts information into the second window, presses the "Done" button, and the information is transfered into the main window. The problem I am having is opening the second window. I have both windows build in xaml files in Visual Studio but I can't find a way to show the second window. Using "Window window = new Window" does not fit my needs because 1) I already have the second window built and 2) I have tried this and I cannot figure out how to add children to the window; there is no window.children nor any grid to put the children into. Thank you in advance!
In the model, I have:
public ObservableCollection<Item> Items { get; private set; }
In the ViewModel, I have a corresponding list of ItemViewModels:
public ObservableCollection<ItemViewModel> ItemViewModels ...
In the XAML, I will bind (in this case a TreeView) to the ItemViewModels property.
My question is, what goes in the "..." in the ViewModel shown above? I am hoping for a line or two of code to binds these two ObservableCollections (providing the type of the ViewModel to construct for each model object). However, what I'm fearing is necessary is a bunch of code to handle the Items.CollectionChanged event and manually updates the ItemViewModels list by constructing ViewModels as necessary.
Thanks!
Eric
I am binding a ListView a property that essentially wraps the Values collection (ICollection) on a generic dictionary.
When the values in the dictionary change, I call OnNotifyPropertyChanged(property). I don't see the updates on the screen, with no binding errors.
When I change the property getter to return the Linq extension dictionary.Values.ToList(), without changing the signature of the property (ICollection) it works with no problem.
Any reason why the Values collection bind and notify properly without projecting to an IList<?
I've run into a case where I have a custom Panel (inherits from Panel) and I'm using it as an ItemsPanel in a ListView.
When I resize the container that it's in, if I resize it smaller, my panel's MeasureOverride function gets called once, but if I resize it larger (let's say from 100 to 300), it calls MeasureOverride and ArrangeOverride for every value between 100 and 300, in increments of 2 (so 102, 104, etc.).
The weird thing is that the container resizes right away (its size gets to 300 immediately).
It doesn't seem to matter what I return from MeasureOverride - it just does this.
I wish I could make it happen in a really small application and post it here, but I haven't been able to reproduce it like that yet. I can reproduce it all day in my app though.
Does anyone know what could cause this?
So say for example I created a few small squares in expression blend.
I then group them together by selecting them, right clicking and selecting "Group Into - Grid"
So now that they are in the grid, I'd like to be able to resize this grid and then they would resize but it doesn't happen, it just resizes the grid but leaves the vectors the same.
Is there a way to do what I am looking for?
p.s I know you can just select all the vectors and then resize them all, but I am looking for a way to just resize one container and not all the objects in there..
In Expression Blend 4, I want to change the Foreground of a custom button on different states. I'm just able to change the Background and BorderBrush.
Just like this:
If the state is "Normal", the color of text "Button" is Black, while the state is "Pressed", the color of text "Button" is White.
On Brushes Panel under Properties Panel, there're 3 properties but no Foreground property:
Who can help me? I'm so perplexed.
Edit
I find ContentControl have a Foreground property, but ContentPresenter haven't. Wether I should use ContentControl instead of ContentPresenter?
I'm new to XAML, so presume I'm missing something simple. I want to replace the path part of the source path with a c# constant for easier path management, for example I have:
<Image Source="/Images/Themes/Buttons/MyPicture.png" />
and in another class I have my constant defined:
public static readonly string UriImagesButtons = "/Images/Big/PNG/";
I want to have something along the lines of:
<Image Source="{static:UriImagesButtons + MyPicture.png}" />
This means that I can change the path globally at a stroke if the need arises. What's the syntax to do this?
Here's the problem.
Given a large/intricate datatemplate A, which has 3 sections - General, Properties, Misc.
Imagine 3 grids for each.
Now I need to reuse the Properties section of the above Datatemplate in another place. Reasons: To avoid redundancy + ensure that further updates to the datatemplate are applied identically to all usages.
So I guess what I am asking for is an ability to slot in a link to a child DataTemplate in a parent Datatemplate. What's the best way to go about this ?
I found one way to do this.. but I'm not sure if its the right way or the best.. Posting it as an answer below so that it can be rated.
Hi All,
I am using some animation on my user control code behind.
I want when i put my mouse on user control the animation should stop.
Can any body help me on this its urgent ...!
Hello Experts!
I'm trying to do a periodic separated thread operation let's say check for internet connection or check for user's info via web service and update the user interface.
i've tried with quartz.net to implement that.So i created an inner class for the window i need to update.That inner class does what is meant for but the problem is that i don't know how to access parent's(window class) members form the child(inner class). for example
public partial class Window2 : Window
{
private int i;
public Window2()
{ InitializeComponent();
}
public string doMyOperation()
{
//code here
return result;
}
public class Myclass :IJob
{
public void Execute(JobExecutionContext context)
{
string result = doMyOperation();
//Now here i could be able to call a label of name lblNotif
//lblNotif.Content = result;
}
}
}
Well the whole idea works but i'm stacked at here i need to access a controls of Window2
Since i'm stacked i tried Spring.Net way of implementing Quartz hoping that i could use MethodInvokingJobDetailFactoryObject and rather have the Operation done on Window2 itself.But for some reason i'm having an exception
Cannot resolve type [System.Windows.Window2,System.Windows];, could not load type from string value System.Windows.Window2,System.Windows
and the wiring is done so
<object name="UpdateLabelJob" type="System.Windows.Window2,System.Windows"/>
What i'm i doing wrong here?Is that a way round? thanks for reading and for helping out