WPF: What is simple way to implement Tab control

Our application uses WPF.
One Window includes TabControl. Each tab header includes image and text.
When the tab is selected, we need to show different image and text in different color.
One way is to create a customized control which include image and textblock. And one of dependency property is "Select".
When Select is true, use different image and set different Foreground for textblock.
Our question, could we use style to achieve this? thx!
JaneC

>>Our question, could we use style to achieve this? thx!
Yes, you could add a DataTrigger to the HeaderTemplate that binds to the IsSelected property of the TabItem and changes any properties of any element within the DataTemplate.
Here is an example that changes the Foreground colour of a TextBlock from Red to Green and the Source of an Image from 1.png to 2.png when the TabItem is selected:
<TabItem Header="1">
<TabItem.HeaderTemplate>
<DataTemplate>
<StackPanel>
<TextBlock x:Name="txt" Text="{Binding}" Foreground="Red"/>
<Image x:Name="img" Source="1.png" Width="10" Height="10"/>
</StackPanel>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=TabItem}}" Value="True">
<Setter TargetName="txt" Property="Foreground" Value="Green"/>
<Setter TargetName="img" Property="Source" Value="2.png"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</TabItem.HeaderTemplate>
<TextBlock>First...</TextBlock>
</TabItem>
Hope that helps.
Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question.

Similar Messages

  • Web - What is easiest way to implement User Security and User Profiles

    Hi, I am new to these forums and kind of new to Java. Sorry if this is in the wrong forum!
    Bit of background to my experience with java
    I have been playing about with java for a number of years and have created a few basic programs such as a screen shot tool that allows you to capture to default locations and look at previews first etc. I am now venturing into web related stuff. I work in IT doing systems testing and have done bits of basic development on various things.
    What I've done so far
    I am using Netbeans IDE 6.7 and MySQL 5.0
    I am trying to learn more complex java and have decided to try build a basic web / database system that basically implements adding / amending / deleting data from a MySQL database through web pages. I am now trying to implement basic user access and profiles. I have so far got the following:
    - MySQL table with user info - username / password
    - JSP page with usual login stuff
    - Servlet that validates the username and password - if correct forwards to main menu page.
    Its as simple as that - there is nothing stopping you just typing in the URL of the main menu page and going from there.
    What I want
    I am wanting to eventually get the following:
    - User authentication so that you have to logon before you can access anything else
    - User profiles that determine what each user can or can't do, restricting the pages / services / options available (i.e. normal user can't delete etc)
    - Would it need some sort of session manager to allow multiple users etc?
    I appreciate this is a fairly open question but what is the easiest way to start implementing this? Not after specific code as I would prefer to try figger things out myself, but a point in the right direction would be great. It doesn't have to be extremely secure as this is just for me at the minute.
    I have spent all day looking at things like session data / url rewriting / security settings in web.xml / bespoke servlets and am now in java overload!

    Hi everyone,
    I've now actually gone back to the tutorial that I linked to above and implemented that using form login and j_security_check.
    Agree with Saish, and although I don't know enough about the other options to give a good reason, using realms and j_security_check just seems to be a bit cluncky and messy. I would also prefer something a bit more generic, that doesn't rely on setting users in glassfish, hence why I started with my own user table.
    Anyway, I will leave it as is for now and maybe come back and try one of the other options.
    The only problem I can see now is that to add users i will need to go through all the steps of adding users in glassfish and web.xml... Is there a way to do this through a servlet or something so I can have a jsp page to add users that also creats all the other bits for it to work?
    Thanks everyone for your help

  • Whats a simple way to repeat a line ?

    i have this program where the user inputs a number and accordingly the question repeats .........any help i want to make it really simple.....i have to teach this to a bunch of students
    i got this so far
    import java.awt.*;
    import hsa.Console;
    public class Reporcassrd
    static Console c = new Console (30,1000);
    static public void main (String args[])
    int num;
    String sentence = "exampleexampleexample;
    c.clear ();
    c.setCursor (2,5);
    c.print ("How many times do you want to repeat the sentence?:");
    num = c.readint () ;
    Message was edited by:
    HALO2RING
    Message was edited by:
    HALO2RING

    Please use code tags
    for (int i = 0; i < num; i++) {
       // out put line how ever you want here.
    }

  • Simple way to handle Exception in Biztalk 2013

    Hello Experts,
    I am working with lots of Orchestration in my Biztalk application, i am using Biztalk 2013.
    Can some one tell me what is simple way to chandle exception.
    I am having requirement to handle exception in 1 day....
    Thanks,
    Thanks and Regards, Nilesh Thakur.

    First thing One day is not enough to implement exception handling framework across your your solution. :-)
    But there are so many things you need to take care, like
    what you want to do with the exception messages
    Do you want to re-submit a message when it has failed in exception.
    how would you plan to test all these exception cases, you need to prepare all your test cases before you procced for the changes. 
    anyways,
    ESB Exception handling framework is the main candidate however you can use built-in throw exception shape in orchestration designer.
    There is an example
    A developers guide to handling exceptions in BizTalk Server 2006/2009/2010 , have a look, you will get your solution,
    All the best.
    Greetings,HTH
    Naushad Alam
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or
    Mark As Answer
    alamnaushad.wordpress.com

  • Best way to implement an EULA popup (imprint) in RH 9

    Hello there ,
    I have a question about RoboHelp 9. The fact is my help page is divided into 2 iframes.
    A left sidebar iframe containing a navigation menu, and a right sided iframe, the main one, containing the data. (index, content, ...)
    The fact is I want, when the user load my helpdesk, to pop up a message, asking him if he agree to the legal terms of our society (EULA).
    If he answer Yes, the popup is closed, and he can navigate freely in the menu, but if he answer No, I want him being redirected on our official website.
    Is there a simple way to implement this kind of popup, with the following features :
    focus locked on the popup (the user cannot naviguate until he didn't agreed)
    the redirection have to take over the whole window, including the iframes (because if he is redirected only on the main iframe, he still can load pages from the left sidebar menu)
    I tried :
    to use BSSCPopup(), but it loses focus as I click outside the popup, and it cannot be closed properly.
    I tried to use jQuery, but RoboHelp don't appreciate the library, and reformat the code (impossible to make it works).
    I tried to use simply javascript, was the best results, as I could keep the focus, close the popup, but the redirection was always made on the main iframe, whatever I tried.
    Thus, that leads me to begging for help, 'cause I just don't get why it's that hard to implement this in RH.
    Thank you for any suggestions or help

    Actually, it is a bit more complex than you think. For example, when the user leaves the page and returns an hour later, you don't want to show the popup (overlay, because you can close a popup) again. This means that you need to save the acceptance in a cookie. The content files should also check whether the terms are accepted and whether the navigation frame is not shown. If the navigation is not shown, the content must show the EULA acceptance overlay as well.
    Note that there will be a way to circumvent this with web development tools if you are using JavaScript (just disable the overlay with the tool). Or even the possibility that JavaScript is turned off. The only reliable way would be server side scripting (PHP etc.) and RH doesn't support that. So make sure that your EULA contains some information on this possibility as well, such as a link in your topics stating that using the pages means that you accept the EULA. This may even be easier to implement, but I have no idea of the legal implications.
    You can use jQuery for RoboHelp (I've used it quite a bit.) In my experience, RoboHelp doesn't reformat the code when it is in an external script file. I use a lot of script files and I have never seen this behaviour before (though that doesn't mean it doesn't of course).
    Such a requirement is a lot of work and the best I can do on the forum is point you in the right direction.
    If you require professional support, contact me via my site: http://www.wvanweelden.eu/ and we can talk about your options. Note that this is not associated with my forum contributions nor is it in any way affiliated with Adobe.
    Greet,
    Willam

  • How to implement complex analysis authorizations in simple way

    Hi All,
    I need to create some analysis authorizations with long list of single values for a characteristics. For example, we have multiple set up of company codes (APAC, EAME, AMERICAS, etc) and each set contains 150 - 200 company codes in it. Now we have multiple combinations of company code set and geographies. In short, we will have multiple analysis authorizations and each will have one or two set of company codes and some geographies.
    I can create the analysis authorizations for the first time, by putting individual values in the respective characteristics. That would be a big task but can be done. But the problem is about ongoing maintenance. In future, if a new company code is added to lets say APAC companies, then we will have to update all analysis authorizations which contains APAC company code and that would be huge number of AAs due to the complexity of business architecture.
    Could anyone please suggest if it is possbile (and how) to do below or similar, or have any other better approach (using BW7.4)
    - We would create a group (or set) of company codes. Lets say would create a group APAC_Comp_Code and add all APAC related company codes in it. This would be repeated for all set of compant codes.
    - While creating analysis authorizatons, I would not assign any individual company code value in characteristic, instead put APA_Comp_Code inside the characteristic 0COMP_CODE.
    - If I need to put multiple set of company codes inside 0COMP_CODE, I will just put the corresponding group name, not the invidual values.
    The benefit would be that in future if I need to add a new company code to APAC, I would just have to update this group APAC_Comp_Code. I will not have to maintain the analysis authorizations.
    Please let me know if this is possible or if there is any other way to implement the requirement with simpler maintenance.
    Thanks
    Nitesh Gupta

    Hi Nitesh,
    From what you describe, this would be a good case to use variables in your analysis authorisations. You can specify a variable value for the BUKRS field and have a couple of options to populate the values which are picked up in the query execution.
    You will need to ensure that you activate the istep to read customer exit variables and have the query variable set as customer-exit. Once those are complete, you can create a custom table to maintain the mapping of groups to company codes, or to read the company codes directly from your ERP system (if you want to base authorisations on what the users can see in ERP) and populate the table with those values.
    However you populate the value to the variable, I think this approach will get you closer to minimal maintenance going forward. Enhancement RSR00001 should be implemented, some help documentation for this below
    http://help.sap.com/saphelp_nw70/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/content.htm
    Hope this helps,
    Tom

  • What is the best way to implement a cluster-wide object ID generator?

    What is the best way to implement a cluster-wide object ID generator?

    What is the best way to implement a cluster-wide
    object ID generator?Always use 3 because it is prime.
    Alternatively more information about the system and the needs of the system might prompt alternative ideas some of which are likely to be better than others for your particular implementation and system constraints.

  • What is the best way to implement writable many-to-many relations

    As everyone knows, the many-to-many associations provided by BC4J are quite good to read many-to-many associations, but they are not able to write such associations.
    There are other solutions using composite associations or cascading-delete foreign keys, but as I was tought now, they are also quite problematic. See thread Internal error: Entity.afterRollback.status_dead   -- What does this mean? for more details.
    So I ask you: What is the best way to implement writable many to many associations? Do you really have to manage them "by hand"?
    Thanks for your ideas
    Frank

    I'd appreciate any hint
    Thanks

  • Best way to implement a simple read of multiple stings from a db

    Hello guys,
    I am trying to read a collection of countries (Strings) into a collection inside a Movie object. The countries reside in a separate DB table with a FK referencing the Movie.
    My questions:
    1) What is the best way to implement this? Do I need a seperate entity 'country' ? Is there a general way to read many strings into a collection?
    2) the countries list does not have to be updated, only read. How do I make sure it is not persistent?
    I have noticed that in my JPA implementation (in netbeans) I do not have something like CollectionOfElements (that is present in hybernate).
    Thank you,
    Marek

    >
    My questions:
    1) What is the best way to implement this? Do I need a seperate entity 'country' ? Is there a general way to read many strings into a collection?
    Probably yes, you need to have one entity for country.for getting the right answer, Post it here - Enterprise Technologies - Java EE SDK (http://forums.sun.com/forum.jspa?forumID=136)

  • What is the best way to implement a scheduled task?

    Dear kind sirs...
    let us say I have a JSF application, and it is working perfectly fine...
    I need the method like
    void DoProcessing()
    *// processing code here*
    to execute everyday at 7AM...
    so what is the best way to do it? I need this to be part of the JSF application... not in a different process... and I want the method to execute at that exact time every day.
    and what are the main steps to do that?
    best regards

    Dear Mr. Chris...
    the reason I am asking about this is because we are required to provide reports for a number of customers by email every day... each report requires retrieving values from a DB.
    I made a test few hours ago about making a thread sleeps and check the time when it wakes up, it works, no problem about that...
    I placed a thread in the servlet context and started it... and it kept working for about an hour writing in the log every 5 seconds... so I guess the idea works...
    but do you think that this way of implementing the scheduler is ok? for I have not done it before and I don't know the cons of such a method.
    thanks for any advice or comment.
    best regards

  • RE-FX - In a Real estate implementation- Is there simple way for graphical?

    In RE-FX - Real estate implementation- Is there simple way for graphical representation of Buildings/Flats etc (Floor Plan, Layout) in SAP without implementing DMS?
    Regds,
    Bala.

    Hi Bala!
    The ways to get documents into RE-FX are described here:
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/fc/7f383b1b793821e10000000a114084/frameset.htm
    RE-FX
    -> Master Data
    -> Document Management
    The easiest way seems to be Business Document Navigator (BDN).
    Hope that helps a little.
    Best regards,
    Uli
    Edited by: Ulrike Wressnig on Aug 27, 2008 9:15 AM

  • What's the way to use the tab button while writing...

    can u tell me?
    whts the way to use tab button while writting in quick office.
    Moderator's Note: Post was moved and changed the title into a subject-related title. This is to keep the forum organized and let other forum users easily see and respond to this post.
    Solved!
    Go to Solution.

    Hi, minhaz784221. To clarify, are you looking for the tab button function on your phone's keyboard to use in the Quickoffice app? If yes, you'll need to press the space bar multiple times to create an indent on your paragraphs. If this does not resolve your inquiry, feel free to add more details in your reply. Keep us posted.

  • What is the best way to implement Carousel i.e. web part in a site page on office 365 site?

    We can implement the Carousel web part in many ways like content By Query Web Part , jquery (nivo) plugin or content search web part etc. But among these which one is the best way to implement to get best performance of the page?
    Thanks

    content search web part always provides best performance because it uses the search. only consideration you need to take is, it does not display the changes immediately and you need to wait for the incremental crawl to happen.
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • What's the best way to implement LOVs in OBIEE?

    Hi All,
    Does anyone have any good ideas on how to go about implementing LOVs in OBIEE?
    At the moment we have created reports and dashboard prompts from the relevant SQL views which report off an Oracle EBS database. Our problem is that when we create a dashboard prompt from this view, that the generation of the LOV will take an extremely long time as it would need to run the whole query and do a distinct on the relevant column, before the LOVs are returned to the user.
    I'd like to find out what possible solutions exist to implement and manage LOVs in OBIEE, and which is the preferred and recommended approach?
    Thanks,
    Lance

    Hi Lance,
    I can think about two things which are indexing and using a dimensional model rather than OLTP.
    Are the views based on huge transaction tables? Are the LOVs based on transactional dates.
    Thanks,
    Manoj.

  • Best way to implement m to n relation?

    Could you please give me some advice on the best way to implement m-n relations in apex?
    Example: I want to store server and database info. A server can have multiple database of course. But in case of a RAC database, the database can be running on multiple servers. So I have tables:
    create table SERVERS (id number primary key, name varchar2(30));
    create table DATABASES(id number primary key, name varchar2(30))
    and an m-to-n table
    create table SERV_DB(serv_id number references SERVERS(id), db_id number references DATABASES(id), instance_name varchar2(30))
    So the table SERV_DB can tell me e.g. that database PROD is running on server 'prdsrv1' with instance PROD1 and on server 'prdsrv2' with instance name PROD2
    How would you design an apex page to maintain this information (adding relations, updating instance names, etc)? I have a solution using checkboxes and 2 for-loops over htmldb_application.g_f40 (to process checkboxes) and g_f41 (to process text fields with instance names) and some delete statements but the logic behind it looks too complex for me. I am convinced that this can be done more simpler. Seems like a common problem to me, so I wonder if there is no out-of-the-box solution in apex for this?
    Could you please show me or create a small demo application with the solution that looks most elegant to you?
    Thanks,
    Geert

    Thanks for your reply. You modified the question slightly, but conceptually it is still the same. What you call the instances table corresponds with my serv_db table. I understand the solution you propose using the tabular report. If I see it correctly, you would have an insert button above the tabular report for each new relation (instance - server) you would want to add. This is ok for the case i used (databases, servers, instances) because there are relatively few relations. However I would not like this solution for other cases. E.g.:
    case: you have a list of persons and a list of tasks. You want to assign tasks to persons in a way that each person has multiple tasks to do and each task can be assigned to multiple persons.
    Suppose you add a new person, and you want to assign 15 tasks to him. The solution above (with the tabular report) would be quite some work because you would have to click 15 times on the insert button and on each click select a task from the select list. In this case it would be more appropriate to, after selecting the new person, see a list of all tasks (e.g. 30 tasks) with a checkbox in front, so you can mark 15 out of the 30 checkboxes and press submit. It gets more complex when you want to assign also an attribute to the relation, i.e. showing the list with all tasks, a checkbox in front and a select list next to each task where you can choose from e.g. "priority high" or "priority low" to indicate that this task is high or low priority for that person. Is there an easy way to implement that?

Maybe you are looking for

  • Patches prob. installing Oracle 8.1.6 ent on Solaris 2.6 Spark ver

    i am installing oralce 8.1.6 enterprise edition database on sunspark solaris 2.6, oracle 8.1.6 requires patches to initiate jre1.1.8_10 to install on solaris 2.6 as specifiled in the installaion manual in the cdrom. i could updated 1 patch , but when

  • Simplify the select query to get single record

    Please let me know what is wrong with my query. Max(p_received_date) is returning null columns too. But i need to have only null record per period, if there is date and null record for the same billing then return the date record. please check novemb

  • FileMonitor issue for date time stamp change.

    Hi I have an app that runs with a minor issue and I am looking for some insight for a workaround or code change. I have a File Monitor that checks a specific directory every second. Users send a batch run to this directory throughout the day. There a

  • Error in Integration Directory Wizzard

    Hi, i am facing a problem with the integration directory wizzard. The Integration Builder Directory is starting. Everything is ok. When i am trying to access the wizzard, the first screen comes up. Now, when i am trying to push the button "Internal C

  • JTable and JFrame

    1) How do I call a JOptionPane dialog when I click the table header? 2) I hv 2 JFrames. The 1st one has a JTable. When I want to insert some record, this JFrame will call another JFrame (Class2). I would like to refresh JTable (1st Class) after closi