code-behind

Get VS2008 to “tree-indent” partial classes (like code-behind files)

邮差的信 提交于 2019-12-08 17:41:55
问题 I have created a multi plattform project, and everything works nicely, except one little things. When I add a specific plattform file, like: ServiceImpl.cs ServiceImpl.Desktop.cs it does not show up nicely in a tree fashion like in this article: Multi-Targeting (check the last image in the article to understand what I mean).. Any ideas how to "teach" VS 2008 to do this? With normal XAML and Code-Behind it works as usual... Ok, the answer worked perfect for a normal situation. Now, there is

Accidentally deleted the code behind for an Xaml file. How do I add the code behind again?

此生再无相见时 提交于 2019-12-08 16:31:37
问题 Instead of excluding it, by mistake, I deleted the .cs code behind file for an Xaml file. Now, I don't know how to add the code behind. This Window is empty with no UI controls on it. "View Code" is disabled and I can't see the Events (lightning bolt icon) anywhere for this xaml. Please help. 回答1: As far as I know without Version Control there is no way to revert back if the project has been saved. You should look into putting your code on Version Control. At this point I would consider

asp.net code behind show images from DB wrapped by lightbox

梦想的初衷 提交于 2019-12-08 12:39:29
问题 I am writing an web app in asp.net, I have in my DB URL of my images and I want to display all the images from my DB wrapped with lightbox my code so far is: <script type="text/javascript" src="Lightbox/js/prototype.js"></script> <script type="text/javascript" src="Lightbox/js/scriptaculous.js?load=effects,builder> </script> <script type="text/javascript" src="Lightbox/js/lightbox.js"></script> <a rel="lightbox" id="userImageLightBox" runat="server" title="profile image"> <img id="userImage"

Listview MouseDoubleClickEvent create in behind code

偶尔善良 提交于 2019-12-08 09:50:32
问题 When I have: <UserControl.Resources> <Style x:Key="itemstyle" TargetType="{x:Type ListViewItem}"> <EventSetter Event="MouseDoubleClick" Handler="HandleDoubleClick" /> <Setter Property="HorizontalContentAlignment" Value="Center" /> </Style> </UserControl.Resources> <Grid> <ListView ItemContainerStyle="itemstyle" Name="listView1" > <ListView.View> <GridView> ... etc Code behind protected void HandleDoubleClick(object sender, MouseButtonEventArgs e) { T item = (T)(((ListViewItem)sender).Content)

ASP.NET databinding / getting variables from codebehind

牧云@^-^@ 提交于 2019-12-08 06:46:03
问题 So I haven't used ASP.NET for three years or so and I'm really rusty on it. My old code isn't available to me for review (at an old company). This question should be pretty basic, but I can't find any good or reliable or not-super-old resources on the issue, so I'm asking here. Can I get a general overview of databinding again? I remember it being really useful for select boxes, etc., but I don't really remember how it works. Maybe a good ASP.NET tutorial in general, because I don't remember

How can I set a StackPanels margins individually?

巧了我就是萌 提交于 2019-12-08 06:23:46
问题 I can set the margin of a stackpanel in code-behind like this: StackPanel sp2 = new StackPanel(); sp2.Margin = new System.Windows.Thickness(5); But how can I set each individually , both of these don't work: PSEUDO-CODE: sp2.Margin = new System.Windows.Thickness("5 0 0 0"); sp2.Margin.Left = new System.Windows.Thickness(5); 回答1: You can also try this: sp2.Margin = new System.Windows.Thickness{ Left = 5 }; 回答2: Margin is of type Thickness which is a structure. The parsing of "5 0 0 0" is a

How do I handle click events on multiple similar buttons in WPF?

扶醉桌前 提交于 2019-12-07 21:21:54
问题 I'm a C# beginner and am trying to implement a numeric pad in WPF. It consists of 10 similar buttons: <Button Content="0" Name="button0" Click="anyButtonClicked" /> <Button Content="1" Name="button1" Click="anyButtonClicked" /> <Button Content="2" Name="button2" Click="anyButtonClicked" /> ... <Button Content="9" Name="button9" Click="anyButtonClicked" /> What is the best practise to handle all those buttons? Do I build a function in the code behind for each one (Which would be mostly boring

WPF - Change a style in code behind

隐身守侯 提交于 2019-12-07 16:44:30
问题 I have a list box that displays the results of a TFS Query. I want to change the style of the ListBoxItem in the code behind to have the columns that are included in the query results. The style for the ListBoxItem is defined in my Windows.Resoruces Section. I have tried this: public T GetQueryResultsElement<T>(string name) where T : DependencyObject { ListBoxItem myListBoxItem = (ListBoxItem)(lstQueryResults.ItemContainerGenerator.ContainerFromIndex(0)); // Getting the ContentPresenter of

call a JQuery function from code behind in C#

旧城冷巷雨未停 提交于 2019-12-07 15:39:31
I want to call this JQuery function from C# code behind but it is not work Here is the JQuery function function showDialog(id, title) { $(id).dialog({ modal: true, minWidth: 600, title: title }); $(id).parent().appendTo($("form:first")); } and here is the code behind which i use ClientScript.RegisterClientScriptBlock(this.GetType(), "myfunction", "$(document).ready(function(){showDialog('#editCustomer','نحديث معلومات عميل');});", true); But it is not work ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "myfunction", "<script type='text/javascript'>myFunction(params...);</script>

How can I change the background color of a gridview cell, based on a conditional statement?

那年仲夏 提交于 2019-12-07 13:44:29
问题 Okay I clearly haven't fed google the right query or I would've found out by now. I'm hoping someone on this forum can help me. So I have a datatable that I'm adding rows to based on a datareader that's getting its info from an sql query executed over a database. So far, so good. Now, one of those columns is called 'analysis', and I need its background color to be green if the preceding two columns are matched, and red otherwise. If I can't touch the background color, I'd like to insert a