.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Listbox border change padding

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :WPF


In snoop I have noticed that the Listbox has a Border child node with a padding="1,1,1,1" (valuesource is parentTemplate).

How can I change this padding to 0?

Here is the wpf code:

     ItemsSource="{Binding AlarmItems}"
     ScrollViewer.VerticalScrollBarVisibility="Disabled" >               

View Complete Post

More Related Resource Links

How can I change the SelectedIndex on a listbox when another listbox is doubleclicked?

Here is my xaml. <     StackPanel>       <ListBox x:Name="List1">       <ListBoxItem>Part 1</ListBoxItem>       <ListBoxItem>Part 2</ListBoxItem>       <ListBoxItem>Part 3</ListBoxItem>       <ListBoxItem>Part 4</ListBoxItem>       <ListBox.Triggers>       <EventTrigger RoutedEvent="ListBox.MouseDoubleClick">       <BeginStoryboard>       <Storyboard Duration="00:00:00">       <Int32Animation Storyboard.TargetName="List2" Storyboard.TargetProperty="SelectedIndex" From="-1" To="0" Duration="00:00:00" FillBehavior="HoldEnd"></Int32Animation>       </Storyboard>       </BeginStoryboard>       </EventTrigger>       </ListBox.Triggers>       </ListBox>       <ListBox x:Name="List2">       <ListBoxItem>Section A</ListBoxItem>       <ListBoxItem>Section B</ListBoxItem>

How to disable fields in a GridView when you change the listbox options?

 Hi all I am trying to apply the same logic I applied to a FormView. Here is what I do:I have a DropDownListBox as one of my FormView fields and when I choose a specific option the fields inside my FormView are enabled/disabled according to the options chosen. Well I havent been able to apply that concept to a GridView. Here is my code to the FormView:protected void ItemFormView_DataBound(object sender, EventArgs e) { DropDownList ddlConfigType = ItemFormView.FindControl("ddlConfigTypes") as DropDownList; if (ddlConfigType != null) { if (ItemFormView.CurrentMode == FormViewMode.Edit) { DisableNAFields_EditMode(ddlConfigType.SelectedItem.Text); } } }private void DisableNAFields_EditMode(string configType) { TextBox txtboxScope = ItemFormView.FindControl("txtboxScope") as TextBox; if (configType == "registry") { txtboxScope.Enabled = false; } } Is there a GridView mode enumeration? How do I achieve the same goal? Thank you

Trap Selected Index change event of listbox using Javascript.

Hi All, This is reagarding listbox selection. I have a list box with multi select option. I want to trap the selected index change event of Listbox through javascript. Item of list box can be selected using Click of mouse and also the keyboard up down key with shift. I tried onclick event to bind the javascript function. It works fine if I select by mouse, but it doesen't work for up/down key of keyboard. Thanks, Naveen

How to change background or border brush color of an element while it has template in xaml?

Dear all, I want to change some style property of one element in code behind while that element already had a data template in xaml. as an example this is a code for my window: <Window x:Class="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" Loaded="Window_Loaded"> <Window.Resources> <Style x:Key="ButtonStyle" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <ControlTemplate.Resources> <Storyboard x:Key="OnMouseEnter1"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="1.1"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Story

Drop Down Listbox SelectedIndexChanged Event not firing when I programmatically change selection

I have two drop down listboxes (DDL1 and DDL2).  When DDL1 has an index change, DDL2 then has a refresh of list items based off SQL Server SELECT from a table.  The database isn't the problem.  Everything works perfectly when the user selects a new item manually from DDL1.But in my code, I save the user data from the selection of DDL1 in a separate table.  And then upon rendering of the page (Page_PreRenderComplete), I do a SelectedIndex assignment of the value of what's saved in the db table.  That works just fine, it selects the DDL1 item, but DDL2 is unaffected, as if DDL1's SelectedIndexChanged event isn't called like it would be if manually changed.  How can I get around this?Thanks in advance. :)

Deletion changes in ListBox that change by java script


Hello all. I have a ListBox in my web page that user can add & delete & edit it's Items in client side by java script codes. when he click save button all items in ListBox saves to data base correctly. problem is: when post back ocuurs with another button all changes in ListBox flies and back to state that page had loaded. what should I do for keeping changes in ListBox during another post backs?

how do I change BORDER COLOR for a TEXTBOX (and any other winform control) in a windforms app in VB

Does anyone have the VB code to change  border colors for winform controls such as a textbox?

RoundedCornersExtenders, change border width?


Is it possible, either through layout tricks, or modifying the roundedCorners.js file, to change the default border width of the roundedCornersExtender?  I would like to make the border a little thicker than the default 1px width.

I have read a few people who have tried to do this but no one could seem to come up with anything, and most of the posts were several years old, so I wanted to check back and see if anyone knows if this is possible?

Thanks in advance!

WPF: how to change groupbox border color in a special case?


our application include several groupbox. so we define general style for the groundbox as following:

<BorderGapMaskConverter x:Key="BorderGapMaskConverter"/>
 <Style x:Key="GeneralGroupBoxStyle" TargetType="{x:Type GroupBox}">
  <Setter Property="BorderThickness" Value="2"/>
  <Setter Property="Template">
      <ControlTemplate TargetType="{x:Type GroupBox}">
        <Grid SnapsToDevicePixels="true">
            <ColumnDefinition Width="6"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="6"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="6"/>
            <ContentPresenter Grid.ColumnSpan="2" 
                Margin="{TemplateBinding Padding}" 
                Grid.Row="2" SnapsToDev

How to change border color of GroupBox in C#.NET?


     I need  to change the Border color of a Groupbox In C#.NET. How can i change it ?

Thanks in advance,

ListBox tricky to set in a DataGrid/GridView

Listboxes are very tricky to set selected items in grid - there is no real nice way to do it. It would have been great if Microsoft included a property that accepts an array or comma separated values - or anything! But they only allow each item in the list to be selected individually. The way to do this in a grid is a bit messy, but it is fairly simple to implement. When a row is created (as per the event), select the items of the listbox as per the datagrid source data:

Working with DropDownList and ListBox Controls in ASP.NET

"In my application i am using dropdownlist to display all categories from a table. When the user clicks this control I display all records in that category. Category table also contains column called color.

I wanted display some categories in dropdown list different color and others in different color using ASP.NET."-Anonymous

How to Localize Windows Forms and Change the Language at Runtime

Localization is the process of customizing your application to a particular language, culture or locale. Visual Studio provides support for localizing Windows Forms with much ease. In this article, we will see how to localize windows forms and give the user the ability to change to his preferred language at runtime.
When you run a localized application, the appearance is determined by two culture values. The UICulture property is used to specify which resource files will be loaded for the form. The Culture property, on the other hand, determines how strings such as dates, numerals, and currency amounts are formatted.
Let us see the steps required to create a localized form. You can then expand this example and adopt the same approach for the rest of the forms in your project

Selected to change the background color of the page



As this site, http://www.borfin.com.tr/genel/Default.aspx, How can I change the background color selected pages.

Bug: Does not change column type from nvarchar to ntext


Scenario: If you create a table with a column of type nvarchar, populate it with some content and try to modify it using the WebMatrix editor, from nvarchar to ntext, it does not display any error message or warning that this is not possible. It silently saves and reverts the change, back to nvarchar. Wasted some hours on this issue as I thought my column was ntext, but in fact was still nvarchar.

Expected behavior: It should change to ntext, or if SQL CE doesn't support that, it should notify the user that no change was applied.

How to change the default page base class?


I've tried setting the <pages pageBaseType="DynamicWebPage" /> value in web.config, but when I response.write out the page type, I'm still getting Microsoft.WebPages.WebPage.

I'm simply trying to sub-class WebPage and add some additional functionality such as a dynamic PageData dictionary similar to Phil Haack's dynamic ViewData dictionary.



SqlDataSource how to change the stored procedures at run time



Is it possible to change the select, insert and update stored procedure of an SqlDataSource at run time. I don't mean to change the definition of the stored procedure, but I mean to change the assignment, i.e. To change the select stored procedure from "selectSP1" to "selectSP2" at run time. Is it possible?



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend